
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>JS编写UI · EasyClick开发文档</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="ui-js-template.html" />
    
    
    <link rel="prev" href="ui-custom.html" />
    

    
        <link rel="shortcut icon" href="/zh-cn/images/ico.png" type="image/x-icon">
    
    
    
    
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="/zh-cn/images/ico.png">
    
    
        
    
    
        
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../features.html">
            
                <a href="../features.html">
            
                    
                    特性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../changelog.html">
            
                <a href="../changelog.html">
            
                    
                    更改记录
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../getting-start.html">
            
                <a href="../getting-start.html">
            
                    
                    开始
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="devtools/dev-tools.html">
            
                <a href="devtools/dev-tools.html">
            
                    
                    开发工具介绍
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="devtools/dev-tools-install.html">
            
                <a href="devtools/dev-tools-install.html">
            
                    
                    安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="devtools/dev-tools-project.html">
            
                <a href="devtools/dev-tools-project.html">
            
                    
                    工程相关
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="devtools/dev-tools-device.html">
            
                <a href="devtools/dev-tools-device.html">
            
                    
                    设备相关
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="devtools/dev-tools-screen.html">
            
                <a href="devtools/dev-tools-screen.html">
            
                    
                    屏幕相关
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="devtools/dev-tools-settings.html">
            
                <a href="devtools/dev-tools-settings.html">
            
                    
                    设置
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../funcs.html">
            
                <a href="../funcs.html">
            
                    
                    功能函数
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="global/global.html">
            
                <a href="global/global.html">
            
                    
                    全局模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="global/global-shortcut.html">
            
                <a href="global/global-shortcut.html">
            
                    
                    全局快捷事件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="global/selector-node.html">
            
                <a href="global/selector-node.html">
            
                    
                    选择器&节点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="acevent-api.html">
            
                <a href="acevent-api.html">
            
                    
                    无障碍事件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="event-api.html">
            
                <a href="event-api.html">
            
                    
                    代理事件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="image-api.html">
            
                <a href="image-api.html">
            
                    
                    图色函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="device-api.html">
            
                <a href="device-api.html">
            
                    
                    设备函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8" data-path="file-api.html">
            
                <a href="file-api.html">
            
                    
                    文件函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9" data-path="http-api.html">
            
                <a href="http-api.html">
            
                    
                    网络函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.10" data-path="thread-api.html">
            
                <a href="thread-api.html">
            
                    
                    线程函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.11" data-path="utils-api.html">
            
                <a href="utils-api.html">
            
                    
                    常用工具函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.12" data-path="shell-api.html">
            
                <a href="shell-api.html">
            
                    
                    Shell命令函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.13" data-path="sqlite-api.html">
            
                <a href="sqlite-api.html">
            
                    
                    Sqlite命令函数
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="ui-custom.html">
            
                <a href="ui-custom.html">
            
                    
                    原生UI定制
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.7.1" data-path="ui-js-inter.html">
            
                <a href="ui-js-inter.html">
            
                    
                    JS编写UI
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="ui-js-template.html">
            
                <a href="ui-js-template.html">
            
                    
                    模板式UI
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="ui-native-view.html">
            
                <a href="ui-native-view.html">
            
                    
                    原生UI控件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.3.1" data-path="ui/linearlayout.html">
            
                <a href="ui/linearlayout.html">
            
                    
                    LinearLayout线性布局
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.2" data-path="ui/framelayout.html">
            
                <a href="ui/framelayout.html">
            
                    
                    FrameLayout帧布局
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.3" data-path="ui/relativelayout.html">
            
                <a href="ui/relativelayout.html">
            
                    
                    RelativeLayout绝对布局
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.4" data-path="ui/scrollview.html">
            
                <a href="ui/scrollview.html">
            
                    
                    ScrollView滚动框
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.5" data-path="ui/view.html">
            
                <a href="ui/view.html">
            
                    
                    View视图
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.6" data-path="ui/button.html">
            
                <a href="ui/button.html">
            
                    
                    Button按钮
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.7" data-path="ui/textview.html">
            
                <a href="ui/textview.html">
            
                    
                    TextView文本
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.8" data-path="ui/edittext.html">
            
                <a href="ui/edittext.html">
            
                    
                    EditText输入框
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.9" data-path="ui/checkbox.html">
            
                <a href="ui/checkbox.html">
            
                    
                    CheckBox复选框
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.10" data-path="ui/radiogroup.html">
            
                <a href="ui/radiogroup.html">
            
                    
                    RadioGroup布局
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.11" data-path="ui/radiobutton.html">
            
                <a href="ui/radiobutton.html">
            
                    
                    RadioButton单选框
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.12" data-path="ui/spinner.html">
            
                <a href="ui/spinner.html">
            
                    
                    Spinner下拉选择框
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.13" data-path="ui/webview.html">
            
                <a href="ui/webview.html">
            
                    
                    WebView内嵌浏览器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.14" data-path="ui/imageview.html">
            
                <a href="ui/imageview.html">
            
                    
                    ImageView图像
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.15" data-path="ui/cardview.html">
            
                <a href="ui/cardview.html">
            
                    
                    CardView卡片布局
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3.16" data-path="ui/switch.html">
            
                <a href="ui/switch.html">
            
                    
                    Swtich开关按钮
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="html-ui-custom.html">
            
                <a href="html-ui-custom.html">
            
                    
                    H5 UI定制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../hot-update.html">
            
                <a href="../hot-update.html">
            
                    
                    热更新功能
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../zk/zk.html">
            
                <a href="../zk/zk.html">
            
                    
                    企业版中控接口
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" data-path="../zk/zk-ec-state.html">
            
                <a href="../zk/zk-ec-state.html">
            
                    
                    EC状态控制接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" data-path="../zk/zk-node.html">
            
                <a href="../zk/zk-node.html">
            
                    
                    全局节点模块接口
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.2.1" data-path="../zk/global/zk-global-log.html">
            
                <a href="../zk/global/zk-global-log.html">
            
                    
                    日志接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2.2" data-path="../zk/global/zk-node-service.html">
            
                <a href="../zk/global/zk-node-service.html">
            
                    
                    节点服务接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2.3" data-path="../zk/global/zk-global-click.html">
            
                <a href="../zk/global/zk-global-click.html">
            
                    
                    点击动作接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2.4" data-path="../zk/global/zk-global-multitouch.html">
            
                <a href="../zk/global/zk-global-multitouch.html">
            
                    
                    多点触摸动作接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2.5" data-path="../zk/global/zk-global-swipe.html">
            
                <a href="../zk/global/zk-global-swipe.html">
            
                    
                    滑动动作接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2.6" data-path="../zk/global/zk-global-drag.html">
            
                <a href="../zk/global/zk-global-drag.html">
            
                    
                    拖动动作接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2.7" data-path="../zk/global/zk-global-input.html">
            
                <a href="../zk/global/zk-global-input.html">
            
                    
                    输入动作接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2.8" data-path="../zk/global/zk-global-node.html">
            
                <a href="../zk/global/zk-global-node.html">
            
                    
                    节点操作接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2.9" data-path="../zk/global/zk-global-systemkey.html">
            
                <a href="../zk/global/zk-global-systemkey.html">
            
                    
                    系统按键接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2.10" data-path="../zk/global/zk-global-notice.html">
            
                <a href="../zk/global/zk-global-notice.html">
            
                    
                    通知栏接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2.11" data-path="../zk/global/zk-global-floatview.html">
            
                <a href="../zk/global/zk-global-floatview.html">
            
                    
                    悬浮窗接口
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10.3" data-path="../zk/zk-agent.html">
            
                <a href="../zk/zk-agent.html">
            
                    
                    代理事件模块接口 - 开发中
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.4" data-path="../zk/zk-image.html">
            
                <a href="../zk/zk-image.html">
            
                    
                    图色模块接口 - 开发中
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.5" data-path="../zk/zk-device.md">
            
                <span>
            
                    
                    设备模块接口 - 开发中
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.6" data-path="../zk/zk-file.md">
            
                <span>
            
                    
                    文件模块接口 - 开发中
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.7" data-path="../zk/zk-http.md">
            
                <span>
            
                    
                    网络模块接口 - 开发中
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.8" data-path="../zk/zk-utils.md">
            
                <span>
            
                    
                    常用工具模块接口 - 开发中
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.9" data-path="../zk/zk-shell.md">
            
                <span>
            
                    
                    Shell命令模块接口 - 开发中
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.10" data-path="../zk/zk-sqlite.md">
            
                <span>
            
                    
                    Sqlite模块接口 - 开发中
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="plugin/plugins.html">
            
                <a href="plugin/plugins.html">
            
                    
                    插件开发
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../question-answer.html">
            
                <a href="../question-answer.html">
            
                    
                    常见问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../agreement.html">
            
                <a href="../agreement.html">
            
                    
                    用户协议
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="../declare.html">
            
                <a href="../declare.html">
            
                    
                    免责声明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15" >
            
                <span>
            
                    
                    技术交流 QQ群：777164022
            
                </span>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >JS编写UI</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#&#x8BF4;&#x660E;"><b>1. </b>&#x8BF4;&#x660E;</a></li><li><span class="title-icon "></span><a href="#&#x5982;&#x4F55;&#x4F7F;&#x7528;"><b>2. </b>&#x5982;&#x4F55;&#x4F7F;&#x7528;</a></li><li><span class="title-icon "></span><a href="#&#x9AD8;&#x7EA7;&#x64CD;&#x4F5C;"><b>3. </b>&#x9AD8;&#x7EA7;&#x64CD;&#x4F5C;</a></li><li><span class="title-icon "></span><a href="#&#x529F;&#x80FD;&#x51FD;&#x6570;&#x8BF4;&#x660E;"><b>4. </b>&#x529F;&#x80FD;&#x51FD;&#x6570;&#x8BF4;&#x660E;</a></li><ul><li><span class="title-icon "></span><a href="#&#x6D88;&#x606F;&#x7C7B;"><b>4.1. </b>&#x6D88;&#x606F;&#x7C7B;</a></li><li><span class="title-icon "></span><a href="#&#x6D88;&#x606F;&#x51FD;&#x6570;-toast"><b>4.2. </b>&#x6D88;&#x606F;&#x51FD;&#x6570; toast</a></li><li><span class="title-icon "></span><a href="#&#x65E5;&#x5FD7;&#x51FD;&#x6570;-logd"><b>4.3. </b>&#x65E5;&#x5FD7;&#x51FD;&#x6570; logd</a></li><li><span class="title-icon "></span><a href="#&#x5E03;&#x5C40;ui&#x7C7B;"><b>4.4. </b>&#x5E03;&#x5C40;UI&#x7C7B;</a></li><ul><li><span class="title-icon "></span><a href="#&#x8BBE;&#x7F6E;&#x5E03;&#x5C40;-layout"><b>4.4.1. </b>&#x8BBE;&#x7F6E;&#x5E03;&#x5C40; layout</a></li><li><span class="title-icon "></span><a href="#&#x89E3;&#x6790;&#x5E03;&#x5C40;-parseview"><b>4.4.2. </b>&#x89E3;&#x6790;&#x5E03;&#x5C40; parseView</a></li><li><span class="title-icon "></span><a href="#&#x67E5;&#x627E;&#x89C6;&#x56FE;-findviewbytag"><b>4.4.3. </b>&#x67E5;&#x627E;&#x89C6;&#x56FE; findViewByTag</a></li><li><span class="title-icon "></span><a href="#&#x8BBE;&#x7F6E;&#x4E8B;&#x4EF6;-setevent"><b>4.4.4. </b>&#x8BBE;&#x7F6E;&#x4E8B;&#x4EF6; setEvent</a></li><li><span class="title-icon "></span><a href="#&#x83B7;&#x53D6;&#x6839;&#x89C6;&#x56FE;-getrootview"><b>4.4.5. </b>&#x83B7;&#x53D6;&#x6839;&#x89C6;&#x56FE; getRootView</a></li><li><span class="title-icon "></span><a href="#&#x8BBE;&#x7F6E;&#x89C6;&#x56FE;&#x503C;-setviewvalue"><b>4.4.6. </b>&#x8BBE;&#x7F6E;&#x89C6;&#x56FE;&#x503C; setViewValue</a></li><li><span class="title-icon "></span><a href="#&#x83B7;&#x53D6;&#x89C6;&#x56FE;&#x503C;-getviewvalue"><b>4.4.7. </b>&#x83B7;&#x53D6;&#x89C6;&#x56FE;&#x503C; getViewValue</a></li><li><span class="title-icon "></span><a href="#&#x53D6;&#x5F97;ui&#x914D;&#x7F6E;&#x503C;-getconfigjson"><b>4.4.8. </b>&#x53D6;&#x5F97;UI&#x914D;&#x7F6E;&#x503C; getConfigJSON</a></li><li><span class="title-icon "></span><a href="#&#x53D6;&#x5F97;&#x5355;&#x4E2A;ui&#x503C;-getconfig"><b>4.4.9. </b>&#x53D6;&#x5F97;&#x5355;&#x4E2A;UI&#x503C; getConfig</a></li><li><span class="title-icon "></span><a href="#&#x4FDD;&#x5B58;&#x6240;&#x6709;ui&#x503C;-saveallconfig"><b>4.4.10. </b>&#x4FDD;&#x5B58;&#x6240;&#x6709;UI&#x503C; saveAllConfig</a></li><li><span class="title-icon "></span><a href="#&#x4FDD;&#x5B58;&#x5355;&#x4E2A;ui&#x503C;-saveconfig"><b>4.4.11. </b>&#x4FDD;&#x5B58;&#x5355;&#x4E2A;UI&#x503C; saveConfig</a></li><li><span class="title-icon "></span><a href="#&#x8BFB;&#x53D6;&#x56FE;&#x50CF;&#x8D44;&#x6E90;-resresasdrawable"><b>4.4.12. </b>&#x8BFB;&#x53D6;&#x56FE;&#x50CF;&#x8D44;&#x6E90; resResAsDrawable</a></li></ul><li><span class="title-icon "></span><a href="#&#x6D6E;&#x7A97;&#x7C7B;"><b>4.5. </b>&#x6D6E;&#x7A97;&#x7C7B;</a></li><ul><li><span class="title-icon "></span><a href="#&#x6D6E;&#x7A97;&#x6743;&#x9650;-hasfloatviewpermission"><b>4.5.1. </b>&#x6D6E;&#x7A97;&#x6743;&#x9650; hasFloatViewPermission</a></li><li><span class="title-icon "></span><a href="#&#x8BF7;&#x6C42;&#x6D6E;&#x7A97;&#x6743;&#x9650;-requestfloatviewpermissionasync"><b>4.5.2. </b>&#x8BF7;&#x6C42;&#x6D6E;&#x7A97;&#x6743;&#x9650; requestFloatViewPermissionAsync</a></li><li><span class="title-icon "></span><a href="#&#x5C55;&#x793A;&#x65E5;&#x5FD7;&#x6D6E;&#x7A97;-showlogwindow"><b>4.5.3. </b>&#x5C55;&#x793A;&#x65E5;&#x5FD7;&#x6D6E;&#x7A97; showLogWindow</a></li><li><span class="title-icon "></span><a href="#&#x5173;&#x95ED;&#x65E5;&#x5FD7;&#x6D6E;&#x7A97;-closelogwindow"><b>4.5.4. </b>&#x5173;&#x95ED;&#x65E5;&#x5FD7;&#x6D6E;&#x7A97; closeLogWindow</a></li></ul><li><span class="title-icon "></span><a href="#&#x811A;&#x672C;&#x542F;&#x52A8;"><b>4.6. </b>&#x811A;&#x672C;&#x542F;&#x52A8;</a></li><ul><li><span class="title-icon "></span><a href="#&#x662F;&#x5426;&#x662F;&#x65E0;&#x969C;&#x788D;&#x6A21;&#x5F0F;-isaccmode"><b>4.6.1. </b>&#x662F;&#x5426;&#x662F;&#x65E0;&#x969C;&#x788D;&#x6A21;&#x5F0F; isAccMode</a></li><li><span class="title-icon "></span><a href="#&#x662F;&#x5426;&#x662F;&#x4EE3;&#x7406;&#x6A21;&#x5F0F;-isagentmode"><b>4.6.2. </b>&#x662F;&#x5426;&#x662F;&#x4EE3;&#x7406;&#x6A21;&#x5F0F; isAgentMode</a></li><li><span class="title-icon "></span><a href="#&#x81EA;&#x52A8;&#x5316;&#x670D;&#x52A1;&#x662F;&#x5426;&#x6B63;&#x5E38;-isserviceok"><b>4.6.3. </b>&#x81EA;&#x52A8;&#x5316;&#x670D;&#x52A1;&#x662F;&#x5426;&#x6B63;&#x5E38; isServiceOk</a></li><li><span class="title-icon "></span><a href="#&#x8BBE;&#x7F6E;&#x8FD0;&#x884C;&#x6A21;&#x5F0F;-setrunningmode"><b>4.6.4. </b>&#x8BBE;&#x7F6E;&#x8FD0;&#x884C;&#x6A21;&#x5F0F; setRunningMode</a></li><li><span class="title-icon "></span><a href="#&#x5F02;&#x6B65;&#x542F;&#x52A8;&#x81EA;&#x52A8;&#x5316;&#x73AF;&#x5883;-startenvasync"><b>4.6.5. </b>&#x5F02;&#x6B65;&#x542F;&#x52A8;&#x81EA;&#x52A8;&#x5316;&#x73AF;&#x5883; startEnvAsync</a></li><li><span class="title-icon "></span><a href="#&#x542F;&#x52A8;&#x6D4B;&#x8BD5;&#x811A;&#x672C;-start"><b>4.6.6. </b>&#x542F;&#x52A8;&#x6D4B;&#x8BD5;&#x811A;&#x672C; start</a></li><li><span class="title-icon "></span><a href="#&#x505C;&#x6B62;&#x6D4B;&#x8BD5;&#x811A;&#x672C;-stoptask"><b>4.6.7. </b>&#x505C;&#x6B62;&#x6D4B;&#x8BD5;&#x811A;&#x672C; stopTask</a></li></ul><li><span class="title-icon "></span><a href="#&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;"><b>4.7. </b>&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;</a></li><ul><li><span class="title-icon "></span><a href="#&#x5F00;&#x542F;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;-startjob"><b>4.7.1. </b>&#x5F00;&#x542F;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1; startJob</a></li><li><span class="title-icon "></span><a href="#&#x53D6;&#x6D88;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;-canceljob"><b>4.7.2. </b>&#x53D6;&#x6D88;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1; cancelJob</a></li><li><span class="title-icon "></span><a href="#&#x53D6;&#x6D88;&#x6240;&#x6709;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;-cancelalljob"><b>4.7.3. </b>&#x53D6;&#x6D88;&#x6240;&#x6709;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1; cancelAllJob</a></li><li><span class="title-icon "></span><a href="#&#x6240;&#x6709;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;&#x6807;&#x7B7E;-getalljobtag"><b>4.7.4. </b>&#x6240;&#x6709;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;&#x6807;&#x7B7E; getAllJobTag</a></li></ul><li><span class="title-icon "></span><a href="#&#x5176;&#x4ED6;&#x6269;&#x5C55;"><b>4.8. </b>&#x5176;&#x4ED6;&#x6269;&#x5C55;</a></li><ul><li><span class="title-icon "></span><a href="#ui&#x5BF9;&#x5E94;&#x7684;activity-getactivity"><b>4.8.1. </b>UI&#x5BF9;&#x5E94;&#x7684;Activity getActivity</a></li><li><span class="title-icon "></span><a href="#&#x539F;&#x751F;&#x7684;handler-gethandler"><b>4.8.2. </b>&#x539F;&#x751F;&#x7684;Handler getHandler</a></li><li><span class="title-icon "></span><a href="#&#x6253;&#x5F00;ec&#x7CFB;&#x7EDF;&#x8BBE;&#x7F6E;-openecsystemsetting"><b>4.8.3. </b>&#x6253;&#x5F00;EC&#x7CFB;&#x7EDF;&#x8BBE;&#x7F6E; openECSystemSetting</a></li></ul></ul></ul></div><a href="#&#x8BF4;&#x660E;" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 id="&#x8BF4;&#x660E;"><a name="&#x8BF4;&#x660E;" class="anchor-navigation-ex-anchor" href="#&#x8BF4;&#x660E;"><i class="fa fa-link" aria-hidden="true"></i></a>1. &#x8BF4;&#x660E;</h1>
<ul>
<li>&#x672C;&#x7AE0;&#x8282;&#x4E3B;&#x8981;&#x8BB2;&#x8FF0;JS&#x4E0E;UI&#x5143;&#x7D20;&#x8FDB;&#x884C;&#x4EA4;&#x4E92;</li>
<li>&#x548C;UI&#x4EA4;&#x4E92;&#x7684;&#x7684;js&#x6A21;&#x5757;&#x5BF9;&#x8C61;&#x7EDF;&#x4E00;&#x4EE5; ui&#x5F00;&#x5934;&#xFF0C;&#x4F8B;&#x5982; ui.toast(&quot;msg&quot;)</li>
</ul>
<h1 id="&#x5982;&#x4F55;&#x4F7F;&#x7528;"><a name="&#x5982;&#x4F55;&#x4F7F;&#x7528;" class="anchor-navigation-ex-anchor" href="#&#x5982;&#x4F55;&#x4F7F;&#x7528;"><i class="fa fa-link" aria-hidden="true"></i></a>2. &#x5982;&#x4F55;&#x4F7F;&#x7528;</h1>
<ul>
<li><p>&#x5728;&#x5DE5;&#x7A0B;&#x7684;layout&#x6587;&#x4EF6;&#x5939;&#x4E0B;&#x65B0;&#x5EFA;&#x4E00;&#x4E2A;ui.js&#x6587;&#x4EF6;&#xFF0C;&#x5185;&#x5BB9;&#x4E3A;</p>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>)</span>{
    ui.toast(<span class="hljs-string">&quot;&#x6211;&#x662F;JS&#x63A7;&#x5236;&#x7684;UI&quot;</span>);
}
main();
</code></pre>
</blockquote>
</li>
<li><p>&#x52A0;&#x8F7D;layout&#x7684;main.xml&#x6587;&#x4EF6;&#x5E76;&#x5C55;&#x793A;&#x51FA;&#x6765;&#xFF0C;&#x5185;&#x5BB9;&#x4E3A;</p>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>)</span>{
    ui.toast(<span class="hljs-string">&quot;&#x6211;&#x662F;JS&#x63A7;&#x5236;&#x7684;UI&quot;</span>);
    ui.layout(<span class="hljs-string">&quot;&#x6807;&#x7B7E;1&quot;</span>,<span class="hljs-string">&quot;main.xml&quot;</span>);
}
main();
</code></pre>
</blockquote>
</li>
<li><p>&#x4EE5;&#x4E0A;&#x7684;&#x64CD;&#x4F5C;&#x5373;&#x53EF;&#x5B8C;&#x6210;&#x4E00;&#x4E2A;&#x7B80;&#x5355;&#x7684;&#x5C55;&#x793A;main.xml&#x5E03;&#x5C40;&#x7684;&#x64CD;&#x4F5C;</p>
</li>
</ul>
<h1 id="&#x9AD8;&#x7EA7;&#x64CD;&#x4F5C;"><a name="&#x9AD8;&#x7EA7;&#x64CD;&#x4F5C;" class="anchor-navigation-ex-anchor" href="#&#x9AD8;&#x7EA7;&#x64CD;&#x4F5C;"><i class="fa fa-link" aria-hidden="true"></i></a>3. &#x9AD8;&#x7EA7;&#x64CD;&#x4F5C;</h1>
<ul>
<li>&#x7F16;&#x5199;&#x4E00;&#x4E2A;ui.js</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-comment">/**
 * &#x8BE5;&#x6587;&#x4EF6;&#x7531;EasyClick&#x5F00;&#x53D1;&#x5DE5;&#x5177;&#x81EA;&#x52A8;&#x521B;&#x5EFA;
 */</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
    ui.toast(<span class="hljs-string">&quot;&#x6211;&#x662F;ui&#x7684;Toast&#x51FD;&#x6570;&quot;</span>);
    <span class="hljs-keyword">var</span> set = ui.layout(<span class="hljs-string">&quot;&#x53C2;&#x6570;&#x8BBE;&#x7F6E;&quot;</span>, <span class="hljs-string">&quot;main.xml&quot;</span>);
    ui.layout(<span class="hljs-string">&quot;&#x5176;&#x4ED6;&#x8BF4;&#x660E;&quot;</span>, <span class="hljs-string">&quot;main2.xml&quot;</span>);
    ui.logd(<span class="hljs-string">&quot;&#x8BBE;&#x7F6E;UI&#x7ED3;&#x679C;: &quot;</span> + set);

    <span class="hljs-comment">//Switch &#x5F00;&#x5173;&#x6309;&#x94AE;&#x7684;&#x7528;&#x6CD5;</span>
    <span class="hljs-keyword">var</span> auto_env = ui.getViewValue(ui.auto_env);
    ui.logd(<span class="hljs-string">&quot;tag&#x4E3A; auto_env &#x7684;&#x503C;: &quot;</span> + auto_env);
    <span class="hljs-comment">//&#x5F00;&#x5173;&#x6309;&#x94AE;&#x7684;&#x4E8B;&#x4EF6;</span>
    ui.setEvent(ui.auto_env, <span class="hljs-string">&quot;checkedChange&quot;</span>, <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">view, isChecked</span>) </span>{
        ui.logd(<span class="hljs-string">&quot;tag&#x4E3A; auto_env isChecked &quot;</span> + isChecked);
        <span class="hljs-keyword">if</span> (isChecked) {
            startAutoEnv();
        }
    });
    <span class="hljs-keyword">if</span> (ui.isServiceOk()) {
        ui.auto_env.setChecked(<span class="hljs-literal">true</span>);
    } <span class="hljs-keyword">else</span> {
        ui.auto_env.setChecked(<span class="hljs-literal">false</span>);
    }

    <span class="hljs-comment">//EditText &#x7F16;&#x8F91;&#x6846;&#x7684;&#x7528;&#x6CD5;</span>
    <span class="hljs-keyword">var</span> name = ui.getViewValue(ui.name);
    ui.logd(<span class="hljs-string">&quot;tag&#x4E3A;name&#x7684;&#x503C;: &quot;</span> + name);
    ui.name.setText(<span class="hljs-string">&quot;&#x6211;&#x662F;name&#x7684;&#x503C;&quot;</span>);
    <span class="hljs-comment">//Spinner &#x4E0B;&#x62C9;&#x9009;&#x62E9;&#x6846;&#x7528;&#x6CD5;</span>
    <span class="hljs-keyword">var</span> sex = ui.getViewValue(ui.sex);
    ui.logd(<span class="hljs-string">&quot;tag&#x4E3A; sex &#x7684;&#x503C;: &quot;</span> + sex);
    <span class="hljs-comment">//&#x4E0B;&#x62C9;&#x9009;&#x62E9;&#x6846;&#x7684;&#x4E8B;&#x4EF6;</span>
    ui.setEvent(ui.sex, <span class="hljs-string">&quot;itemSelected&quot;</span>, <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">position, value</span>) </span>{
        ui.logd(<span class="hljs-string">&quot;tag&#x4E3A; sex itemSelected &quot;</span> + value);
    });

    <span class="hljs-comment">//RadioButton &#x5355;&#x9009;&#x6846;&#x7528;&#x6CD5;</span>
    <span class="hljs-keyword">var</span> three = ui.getViewValue(ui.three);
    ui.logd(<span class="hljs-string">&quot;tag&#x4E3A; three &#x7684;&#x503C;: &quot;</span> + three);
    <span class="hljs-comment">//&#x5355;&#x9009;&#x6846;&#x7684;&#x4E8B;&#x4EF6;</span>
    ui.setEvent(ui.three, <span class="hljs-string">&quot;checkedChange&quot;</span>, <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">view, isChecked</span>) </span>{
        ui.logd(<span class="hljs-string">&quot;tag&#x4E3A; three isChecked &quot;</span> + isChecked);
    });
    <span class="hljs-comment">//CheckBox &#x590D;&#x9009;&#x6846;&#x7528;&#x6CD5;</span>
    <span class="hljs-keyword">var</span> dance = ui.getViewValue(ui.dance);
    ui.logd(<span class="hljs-string">&quot;tag&#x4E3A; dance &#x7684;&#x503C;: &quot;</span> + dance);
    <span class="hljs-comment">//&#x590D;&#x9009;&#x6846;&#x7684;&#x4E8B;&#x4EF6;</span>
    ui.setEvent(ui.dance, <span class="hljs-string">&quot;checkedChange&quot;</span>, <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">view, isChecked</span>) </span>{
        ui.logd(<span class="hljs-string">&quot;tag&#x4E3A; dance isChecked &quot;</span> + isChecked);
    });

    <span class="hljs-comment">//saveAllBtn &#x4FDD;&#x5B58;&#x53C2;&#x6570;&#x4E8B;&#x4EF6;</span>
    ui.setEvent(ui.saveAllBtn, <span class="hljs-string">&quot;click&quot;</span>, <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">view</span>) </span>{
        <span class="hljs-keyword">var</span> s = ui.saveAllConfig();
        ui.logd(<span class="hljs-string">&quot;&#x4FDD;&#x5B58;&#x6240;&#x6709;&#x53C2;&#x6570;&#x7ED3;&#x679C; &quot;</span> + s)
    });

    <span class="hljs-comment">//&#x7CFB;&#x7EDF;&#x8BBE;&#x7F6E;&#x6309;&#x94AE;</span>
    ui.setEvent(ui.systemSetting, <span class="hljs-string">&quot;click&quot;</span>, <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">view</span>) </span>{
        ui.openECSystemSetting();

    });
    <span class="hljs-comment">//&#x542F;&#x52A8;&#x811A;&#x672C;&#x6309;&#x94AE;</span>
    ui.setEvent(ui.startBtn, <span class="hljs-string">&quot;click&quot;</span>, <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">view</span>) </span>{
        ui.start();
    });
    <span class="hljs-comment">//&#x542F;&#x52A8;&#x73AF;&#x5883;&#x6309;&#x94AE;</span>
    ui.setEvent(ui.envBtn, <span class="hljs-string">&quot;click&quot;</span>, <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">view</span>) </span>{
        <span class="hljs-comment">//&#x5F02;&#x6B65;&#x542F;&#x52A8;&#x73AF;&#x5883;&#xFF0C;&#x5982;&#x679C;&#x6210;&#x529F;&#x4E86;&#x5C31;&#x8BBE;&#x7F6E;auto_env &#x6309;&#x94AE;&#x7684;&#x72B6;&#x6001;</span>
        startAutoEnv();
    });
    <span class="hljs-comment">//&#x83B7;&#x53D6;&#x6240;&#x6709;&#x7684;UI&#x53C2;&#x6570;</span>
    ui.logd(<span class="hljs-string">&quot;&#x83B7;&#x53D6;&#x6240;&#x6709;&#x7684;UI&#x53C2;&#x6570;&#xFF1A;&quot;</span> + ui.getConfigJSON());
    <span class="hljs-comment">//&#x8BBE;&#x7F6E;&#x503C;&#x7684;&#x7528;&#x6CD5;&#xFF0C;&#x8FD9;&#x91CC;&#x5148;&#x6CE8;&#x91CA;&#x6389;</span>
    <span class="hljs-comment">// ui.setViewValue(ui.name, &quot;&#x6211;&#x662F;&#x8BBE;&#x7F6E;&#x7684;&quot;);</span>
    <span class="hljs-comment">// ui.setViewValue(ui.auto_env, false);</span>
    <span class="hljs-comment">// ui.setViewValue(ui.sex, &quot;&#x7537;&#x751F;|&#x5973;&#x751F;&quot;);</span>
    <span class="hljs-comment">// ui.setViewValue(ui.three, true);</span>
    <span class="hljs-comment">// ui.setViewValue(ui.dance, false)</span>

}

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">startAutoEnv</span>(<span class="hljs-params"></span>) </span>{
    ui.startEnvAsync(<span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">r</span>) </span>{
        ui.logd(<span class="hljs-string">&quot;&#x542F;&#x52A8;&#x73AF;&#x5883;&#x7ED3;&#x679C;: &quot;</span> + r);
        ui.auto_env.setChecked(r);
    });
}

main();
</code></pre>
</blockquote>
<h1 id="&#x529F;&#x80FD;&#x51FD;&#x6570;&#x8BF4;&#x660E;"><a name="&#x529F;&#x80FD;&#x51FD;&#x6570;&#x8BF4;&#x660E;" class="anchor-navigation-ex-anchor" href="#&#x529F;&#x80FD;&#x51FD;&#x6570;&#x8BF4;&#x660E;"><i class="fa fa-link" aria-hidden="true"></i></a>4. &#x529F;&#x80FD;&#x51FD;&#x6570;&#x8BF4;&#x660E;</h1>
<h2 id="&#x6D88;&#x606F;&#x7C7B;"><a name="&#x6D88;&#x606F;&#x7C7B;" class="anchor-navigation-ex-anchor" href="#&#x6D88;&#x606F;&#x7C7B;"><i class="fa fa-link" aria-hidden="true"></i></a>4.1. &#x6D88;&#x606F;&#x7C7B;</h2>
<h2 id="&#x6D88;&#x606F;&#x51FD;&#x6570;-toast"><a name="&#x6D88;&#x606F;&#x51FD;&#x6570;-toast" class="anchor-navigation-ex-anchor" href="#&#x6D88;&#x606F;&#x51FD;&#x6570;-toast"><i class="fa fa-link" aria-hidden="true"></i></a>4.2. &#x6D88;&#x606F;&#x51FD;&#x6570; toast</h2>
<ul>
<li>&#x663E;&#x793A;Toast&#x4FE1;&#x606F;</li>
<li>@param msg &#x4FE1;&#x606F;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>)</span>{
    ui.toast(<span class="hljs-string">&quot;&#x6211;&#x662F;JS&#x63A7;&#x5236;&#x7684;UI&quot;</span>);
}
main();
</code></pre>
</blockquote>
<h2 id="&#x65E5;&#x5FD7;&#x51FD;&#x6570;-logd"><a name="&#x65E5;&#x5FD7;&#x51FD;&#x6570;-logd" class="anchor-navigation-ex-anchor" href="#&#x65E5;&#x5FD7;&#x51FD;&#x6570;-logd"><i class="fa fa-link" aria-hidden="true"></i></a>4.3. &#x65E5;&#x5FD7;&#x51FD;&#x6570; logd</h2>
<ul>
<li>&#x8C03;&#x8BD5;&#x65E5;&#x5FD7;&#x6253;&#x5370;</li>
<li>@param msg &#x6253;&#x5370;&#x7684;&#x6D88;&#x606F;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>)</span>{
    ui.logd(<span class="hljs-string">&quot;&#x6211;&#x662F;&#x6D88;&#x606F;&quot;</span>);
}
main();
</code></pre>
</blockquote>
<h2 id="&#x5E03;&#x5C40;ui&#x7C7B;"><a name="&#x5E03;&#x5C40;ui&#x7C7B;" class="anchor-navigation-ex-anchor" href="#&#x5E03;&#x5C40;ui&#x7C7B;"><i class="fa fa-link" aria-hidden="true"></i></a>4.4. &#x5E03;&#x5C40;UI&#x7C7B;</h2>
<h3 id="&#x8BBE;&#x7F6E;&#x5E03;&#x5C40;-layout"><a name="&#x8BBE;&#x7F6E;&#x5E03;&#x5C40;-layout" class="anchor-navigation-ex-anchor" href="#&#x8BBE;&#x7F6E;&#x5E03;&#x5C40;-layout"><i class="fa fa-link" aria-hidden="true"></i></a>4.4.1. &#x8BBE;&#x7F6E;&#x5E03;&#x5C40; layout</h3>
<ul>
<li>&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x5E03;&#x5C40;&#x5E76;&#x8BBE;&#x7F6E;&#x5230;&#x5F53;&#x524D;&#x7684;&#x9875;&#x9762;&#x4E2D;</li>
<li>@param name tab&#x6807;&#x7B7E;&#x7684;&#x540D;&#x79F0;</li>
<li>@param content &#x53EF;&#x4EE5;&#x662F;layout&#x6587;&#x4EF6;&#x5939;&#x4E2D;&#x7684;&#x6587;&#x4EF6;&#x540D;&#x79F0;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x662F;xml&#x6587;&#x4EF6;&#x7684;&#x5185;&#x5BB9;</li>
<li>@return &#x5E03;&#x5C14;&#x578B; true&#x4EE3;&#x8868;&#x6210;&#x529F;&#xFF0C; false&#x4EE3;&#x8868;&#x5931;&#x8D25;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-comment">// xml&#x6587;&#x4EF6;&#x5728;layout&#x6587;&#x4EF6;&#x5939;&#x4E0B;</span>
    <span class="hljs-keyword">var</span> u1=ui.layout(<span class="hljs-string">&quot;&#x53C2;&#x6570;&#x8BF4;&#x660E;&quot;</span>, <span class="hljs-string">&quot;main.xml&quot;</span>);
    <span class="hljs-keyword">var</span> u2=ui.layout(<span class="hljs-string">&quot;&#x5176;&#x4ED6;&#x8BF4;&#x660E;&quot;</span>, <span class="hljs-string">&quot;main2.xml&quot;</span>);
    ui.logd(<span class="hljs-string">&quot;&#x53C2;&#x6570;&#x8BF4;&#x660E;&#x521B;&#x5EFA;&#x7ED3;&#x679C;: &quot;</span> + u1);
    ui.logd(<span class="hljs-string">&quot;&#x5176;&#x4ED6;&#x8BF4;&#x660E;&#x521B;&#x5EFA;&#x7ED3;&#x679C;: &quot;</span> + u2);
}
main();
</code></pre>
</blockquote>
<h3 id="&#x89E3;&#x6790;&#x5E03;&#x5C40;-parseview"><a name="&#x89E3;&#x6790;&#x5E03;&#x5C40;-parseview" class="anchor-navigation-ex-anchor" href="#&#x89E3;&#x6790;&#x5E03;&#x5C40;-parseview"><i class="fa fa-link" aria-hidden="true"></i></a>4.4.2. &#x89E3;&#x6790;&#x5E03;&#x5C40; parseView</h3>
<ul>
<li>&#x89E3;&#x6790;&#x5E03;&#x5C40;&#x5E76;&#x8FD4;&#x56DE;</li>
<li>@param content &#x53EF;&#x4EE5;&#x662F;layout&#x6587;&#x4EF6;&#x5939;&#x4E2D;&#x7684;&#x6587;&#x4EF6;&#x540D;&#x79F0;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x662F;xml&#x6587;&#x4EF6;&#x7684;&#x5185;&#x5BB9;</li>
<li>@return View android&#x7684;View&#x5BF9;&#x8C61;&#xFF0C;&#x89E3;&#x6790;&#x6709;&#x95EE;&#x9898;&#x5C31;&#x662F;null</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-comment">// xml&#x6587;&#x4EF6;&#x5728;layout&#x6587;&#x4EF6;&#x5939;&#x4E0B;</span>
    <span class="hljs-keyword">var</span> u1=ui.parseView(<span class="hljs-string">&quot;main.xml&quot;</span>);
    ui.logd(<span class="hljs-string">&quot;&#x521B;&#x5EFA;&#x7ED3;&#x679C;: &quot;</span> + u1);
}
 main();
</code></pre>
</blockquote>
<h3 id="&#x67E5;&#x627E;&#x89C6;&#x56FE;-findviewbytag"><a name="&#x67E5;&#x627E;&#x89C6;&#x56FE;-findviewbytag" class="anchor-navigation-ex-anchor" href="#&#x67E5;&#x627E;&#x89C6;&#x56FE;-findviewbytag"><i class="fa fa-link" aria-hidden="true"></i></a>4.4.3. &#x67E5;&#x627E;&#x89C6;&#x56FE; findViewByTag</h3>
<ul>
<li>&#x901A;&#x8FC7;tag&#x67E5;&#x627E;&#x5230;&#x4E00;&#x4E2A;&#x89C6;&#x56FE;</li>
<li>@param tag &#x6807;&#x7B7E;&#x503C;</li>
<li>@return View android&#x539F;&#x751F;&#x7684;View&#x5BF9;&#x8C61;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-comment">// xml&#x6587;&#x4EF6;&#x5728;layout&#x6587;&#x4EF6;&#x5939;&#x4E0B;</span>
    <span class="hljs-keyword">var</span> u1=ui.layout(<span class="hljs-string">&quot;&#x53C2;&#x6570;&#x8BF4;&#x660E;&quot;</span>, <span class="hljs-string">&quot;main.xml&quot;</span>);
    <span class="hljs-keyword">var</span> u2=ui.layout(<span class="hljs-string">&quot;&#x5176;&#x4ED6;&#x8BF4;&#x660E;&quot;</span>, <span class="hljs-string">&quot;main2.xml&quot;</span>);
    <span class="hljs-comment">//&#x67E5;&#x627E;tag=name&#x7684;&#x89C6;&#x56FE;</span>
    <span class="hljs-keyword">var</span> nameView =ui.findViewByTag(<span class="hljs-string">&quot;name&quot;</span>);
    ui.logd(<span class="hljs-string">&quot;name view is:&quot;</span>+nameView);
}

main();
</code></pre>
</blockquote>
<h3 id="&#x8BBE;&#x7F6E;&#x4E8B;&#x4EF6;-setevent"><a name="&#x8BBE;&#x7F6E;&#x4E8B;&#x4EF6;-setevent" class="anchor-navigation-ex-anchor" href="#&#x8BBE;&#x7F6E;&#x4E8B;&#x4EF6;-setevent"><i class="fa fa-link" aria-hidden="true"></i></a>4.4.4. &#x8BBE;&#x7F6E;&#x4E8B;&#x4EF6; setEvent</h3>
<ul>
<li>&#x8BBE;&#x7F6E;&#x4E8B;&#x4EF6;</li>
<li>@param view &#x8981;&#x8BBE;&#x7F6E;&#x4E8B;&#x4EF6;&#x7684;&#x89C6;&#x56FE;&#xFF0C;&#x53EF;&#x4EE5;&#x662F;&#x4E8B;&#x4EF6;&#x7684;tag&#x503C;</li>
<li>@param eventType &#x65F6;&#x95F4;&#x7C7B;&#x578B;&#xFF1A; click&#xFF1A;&#x70B9;&#x51FB;&#xFF0C;checkedChange&#xFF1A;&#x5355;&#x9009;&#x548C;&#x591A;&#x9009;&#x6309;&#x94AE;&#x7684;&#x9009;&#x4E2D;&#x72B6;&#x6001;&#x6539;&#x53D8;&#x4E8B;&#x4EF6;&#xFF0C;itemClick&#xFF1A;&#x5217;&#x8868;&#x7684;&#x9879;&#x76EE;&#x70B9;&#x51FB;&#xFF0C;itemSelected&#xFF1A;&#x5217;&#x8868;&#x7684;&#x9879;&#x76EE;&#x9009;&#x4E2D;</li>
<li>@param eventCallback &#x4E8B;&#x4EF6;&#x56DE;&#x8C03;&#x51FD;&#x6570;</li>
<li>@return &#x5E03;&#x5C14;&#x578B; true&#x4EE3;&#x8868;&#x8BBE;&#x7F6E;&#x6210;&#x529F;&#xFF0C; false&#x4EE3;&#x8868;&#x8BBE;&#x7F6E;&#x5931;&#x8D25;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-comment">// xml&#x6587;&#x4EF6;&#x5728;layout&#x6587;&#x4EF6;&#x5939;&#x4E0B;</span>
    <span class="hljs-keyword">var</span> u1=ui.layout(<span class="hljs-string">&quot;&#x53C2;&#x6570;&#x8BF4;&#x660E;&quot;</span>, <span class="hljs-string">&quot;main.xml&quot;</span>);
    <span class="hljs-keyword">var</span> u2=ui.layout(<span class="hljs-string">&quot;&#x5176;&#x4ED6;&#x8BF4;&#x660E;&quot;</span>, <span class="hljs-string">&quot;main2.xml&quot;</span>);
     <span class="hljs-comment">//&#x4E0B;&#x62C9;&#x9009;&#x62E9;&#x6846;&#x7684;&#x4E8B;&#x4EF6;</span>
     ui.setEvent(ui.sex, <span class="hljs-string">&quot;itemSelected&quot;</span>, <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">position, value</span>) </span>{
            ui.logd(<span class="hljs-string">&quot;tag&#x4E3A; sex itemSelected &quot;</span> + value);
     });
     ui.setEvent(ui.dance, <span class="hljs-string">&quot;checkedChange&quot;</span>, <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">view, isChecked</span>) </span>{
         ui.logd(<span class="hljs-string">&quot;tag&#x4E3A; dance isChecked &quot;</span> + isChecked);
     });
     ui.setEvent(ui.startBtn, <span class="hljs-string">&quot;click&quot;</span>, <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">view</span>) </span>{
         ui.start();
     });

}

main();
</code></pre>
</blockquote>
<h3 id="&#x83B7;&#x53D6;&#x6839;&#x89C6;&#x56FE;-getrootview"><a name="&#x83B7;&#x53D6;&#x6839;&#x89C6;&#x56FE;-getrootview" class="anchor-navigation-ex-anchor" href="#&#x83B7;&#x53D6;&#x6839;&#x89C6;&#x56FE;-getrootview"><i class="fa fa-link" aria-hidden="true"></i></a>4.4.5. &#x83B7;&#x53D6;&#x6839;&#x89C6;&#x56FE; getRootView</h3>
<ul>
<li>&#x53D6;&#x5F97;&#x5F53;&#x524D;&#x7684;&#x6839;&#x89C6;&#x56FE;&#x5BF9;&#x8C61;&#xFF0C;&#x56E0;&#x4E3A;&#x6709;&#x53EF;&#x80FD;&#x662F;&#x591A;&#x6807;&#x7B7E;&#x7684;&#x9875;&#x9762;&#xFF0C;&#x8FD4;&#x56DE;&#x7684;&#x6709;&#x53EF;&#x80FD;&#x662F;&#x4E2A;&#x96C6;&#x5408;</li>
<li>@return View &#x5BF9;&#x8C61;&#x5217;&#x8868;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-comment">// xml&#x6587;&#x4EF6;&#x5728;layout&#x6587;&#x4EF6;&#x5939;&#x4E0B;</span>
    <span class="hljs-keyword">var</span> u1=ui.layout(<span class="hljs-string">&quot;&#x53C2;&#x6570;&#x8BF4;&#x660E;&quot;</span>, <span class="hljs-string">&quot;main.xml&quot;</span>);
    <span class="hljs-keyword">var</span> u2=ui.layout(<span class="hljs-string">&quot;&#x5176;&#x4ED6;&#x8BF4;&#x660E;&quot;</span>, <span class="hljs-string">&quot;main2.xml&quot;</span>);
     <span class="hljs-comment">//&#x4E0B;&#x62C9;&#x9009;&#x62E9;&#x6846;&#x7684;&#x4E8B;&#x4EF6;</span>
     <span class="hljs-keyword">var</span> views= ui.getRootView();
     ui.logd(<span class="hljs-string">&quot;views &quot;</span>+views)
     <span class="hljs-keyword">for</span> (<span class="hljs-keyword">var</span> i = <span class="hljs-number">0</span>; i &lt; views.length; i++) {
         <span class="hljs-keyword">var</span> value=views[i];
         ui.logd(<span class="hljs-string">&quot;view-&gt; &quot;</span>+value)
     }
}

main();
</code></pre>
</blockquote>
<h3 id="&#x8BBE;&#x7F6E;&#x89C6;&#x56FE;&#x503C;-setviewvalue"><a name="&#x8BBE;&#x7F6E;&#x89C6;&#x56FE;&#x503C;-setviewvalue" class="anchor-navigation-ex-anchor" href="#&#x8BBE;&#x7F6E;&#x89C6;&#x56FE;&#x503C;-setviewvalue"><i class="fa fa-link" aria-hidden="true"></i></a>4.4.6. &#x8BBE;&#x7F6E;&#x89C6;&#x56FE;&#x503C; setViewValue</h3>
<ul>
<li>&#x8BBE;&#x7F6E;&#x89C6;&#x56FE;&#x7684;&#x503C;</li>
<li>@param tagOrView &#x89C6;&#x56FE;&#x7684;tag&#x6216;&#x8005;&#x89C6;&#x56FE;&#x5BF9;&#x8C61;</li>
<li>@param value &#x503C;&#xFF0C;&#x5B57;&#x7B26;&#x4E32;&#x6216;&#x8005;&#x662F;&#x5E03;&#x5C14;&#x578B;</li>
<li>@return &#x5E03;&#x5C14;&#x578B; true&#x4EE3;&#x8868;&#x6210;&#x529F; false&#x4EE3;&#x8868;&#x5931;&#x8D25;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-comment">// xml&#x6587;&#x4EF6;&#x5728;layout&#x6587;&#x4EF6;&#x5939;&#x4E0B;</span>
    <span class="hljs-keyword">var</span> u1=ui.layout(<span class="hljs-string">&quot;&#x53C2;&#x6570;&#x8BF4;&#x660E;&quot;</span>, <span class="hljs-string">&quot;main.xml&quot;</span>);
    <span class="hljs-keyword">var</span> u2=ui.layout(<span class="hljs-string">&quot;&#x5176;&#x4ED6;&#x8BF4;&#x660E;&quot;</span>, <span class="hljs-string">&quot;main2.xml&quot;</span>);
    <span class="hljs-comment">//ui.name &#x662F;&#x503C;xml&#x4E2D;tag=name&#x7684;&#x89C6;&#x56FE;&#x5BF9;&#x8C61;</span>
    ui.setViewValue(ui.name,<span class="hljs-string">&quot;&#x6211;&#x662F;&#x8BBE;&#x7F6E;&#x7684;&#x540D;&#x79F0;&quot;</span>)

}

main();
</code></pre>
</blockquote>
<h3 id="&#x83B7;&#x53D6;&#x89C6;&#x56FE;&#x503C;-getviewvalue"><a name="&#x83B7;&#x53D6;&#x89C6;&#x56FE;&#x503C;-getviewvalue" class="anchor-navigation-ex-anchor" href="#&#x83B7;&#x53D6;&#x89C6;&#x56FE;&#x503C;-getviewvalue"><i class="fa fa-link" aria-hidden="true"></i></a>4.4.7. &#x83B7;&#x53D6;&#x89C6;&#x56FE;&#x503C; getViewValue</h3>
<ul>
<li>&#x53D6;&#x5F97;&#x89C6;&#x56FE;&#x7684;&#x503C;</li>
<li>@param tagOrView &#x89C6;&#x56FE;&#x7684;tag&#x6216;&#x8005;&#x89C6;&#x56FE;&#x5BF9;&#x8C61;</li>
<li>@return &#x5B57;&#x7B26;&#x4E32;&#x6216;&#x8005;&#x5E03;&#x5C14;&#x578B;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-comment">// xml&#x6587;&#x4EF6;&#x5728;layout&#x6587;&#x4EF6;&#x5939;&#x4E0B;</span>
    <span class="hljs-keyword">var</span> u1=ui.layout(<span class="hljs-string">&quot;&#x53C2;&#x6570;&#x8BF4;&#x660E;&quot;</span>, <span class="hljs-string">&quot;main.xml&quot;</span>);
    <span class="hljs-keyword">var</span> u2=ui.layout(<span class="hljs-string">&quot;&#x5176;&#x4ED6;&#x8BF4;&#x660E;&quot;</span>, <span class="hljs-string">&quot;main2.xml&quot;</span>);
    <span class="hljs-comment">//ui.name &#x662F;&#x503C;xml&#x4E2D;tag=name&#x7684;&#x89C6;&#x56FE;&#x5BF9;&#x8C61;</span>
    ui.setViewValue(ui.name,<span class="hljs-string">&quot;&#x6211;&#x662F;&#x8BBE;&#x7F6E;&#x7684;&#x540D;&#x79F0;&quot;</span>);
    <span class="hljs-keyword">var</span> v = ui.getViewValue(ui.name);

    ui.logd(<span class="hljs-string">&quot;&#x83B7;&#x53D6;name&#x7684;&#x503C;&#x4E3A;: &quot;</span>+v);

}

main();
</code></pre>
</blockquote>
<h3 id="&#x53D6;&#x5F97;ui&#x914D;&#x7F6E;&#x503C;-getconfigjson"><a name="&#x53D6;&#x5F97;ui&#x914D;&#x7F6E;&#x503C;-getconfigjson" class="anchor-navigation-ex-anchor" href="#&#x53D6;&#x5F97;ui&#x914D;&#x7F6E;&#x503C;-getconfigjson"><i class="fa fa-link" aria-hidden="true"></i></a>4.4.8. &#x53D6;&#x5F97;UI&#x914D;&#x7F6E;&#x503C; getConfigJSON</h3>
<ul>
<li>&#x53D6;&#x5F97;&#x6240;&#x6709;UI&#x914D;&#x7F6E;</li>
<li>@return JSON&#x5B57;&#x7B26;&#x4E32;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-comment">// xml&#x6587;&#x4EF6;&#x5728;layout&#x6587;&#x4EF6;&#x5939;&#x4E0B;</span>
    <span class="hljs-keyword">var</span> u1=ui.layout(<span class="hljs-string">&quot;&#x53C2;&#x6570;&#x8BF4;&#x660E;&quot;</span>, <span class="hljs-string">&quot;main.xml&quot;</span>);
    <span class="hljs-keyword">var</span> u2=ui.layout(<span class="hljs-string">&quot;&#x5176;&#x4ED6;&#x8BF4;&#x660E;&quot;</span>, <span class="hljs-string">&quot;main2.xml&quot;</span>);

    ui.setViewValue(ui.name,<span class="hljs-string">&quot;&#x6211;&#x662F;name&quot;</span>);
    <span class="hljs-comment">//&#x4FDD;&#x5B58;&#x6240;&#x6709;&#x7684;&#x503C;</span>
    ui.saveAllConfig();

    <span class="hljs-keyword">var</span> data = ui.getConfigJSON();
    ui.logd(<span class="hljs-string">&quot;data &quot;</span>+data);

    data= <span class="hljs-built_in">JSON</span>.parse(data);
    <span class="hljs-comment">//&#x6253;&#x5370;name&#x7684;&#x503C;&#xFF0C;&#x5982;&#x679C;&#x6CA1;&#x6709;&#x503C;&#x8981;&#x5148;&#x4FDD;&#x5B58;&#x4E00;&#x4E0B;</span>
    ui.logd(data.name);


}

main();
</code></pre>
</blockquote>
<h3 id="&#x53D6;&#x5F97;&#x5355;&#x4E2A;ui&#x503C;-getconfig"><a name="&#x53D6;&#x5F97;&#x5355;&#x4E2A;ui&#x503C;-getconfig" class="anchor-navigation-ex-anchor" href="#&#x53D6;&#x5F97;&#x5355;&#x4E2A;ui&#x503C;-getconfig"><i class="fa fa-link" aria-hidden="true"></i></a>4.4.9. &#x53D6;&#x5F97;&#x5355;&#x4E2A;UI&#x503C; getConfig</h3>
<ul>
<li>&#x53D6;&#x5F97;&#x5355;&#x4E2A;UI&#x914D;&#x7F6E;&#x9879;</li>
<li>@param key &#x914D;&#x7F6E;&#x7684;key</li>
<li>@return &#x5B57;&#x7B26;&#x4E32;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-comment">// xml&#x6587;&#x4EF6;&#x5728;layout&#x6587;&#x4EF6;&#x5939;&#x4E0B;</span>
    <span class="hljs-keyword">var</span> u1=ui.layout(<span class="hljs-string">&quot;&#x53C2;&#x6570;&#x8BF4;&#x660E;&quot;</span>, <span class="hljs-string">&quot;main.xml&quot;</span>);
    <span class="hljs-keyword">var</span> u2=ui.layout(<span class="hljs-string">&quot;&#x5176;&#x4ED6;&#x8BF4;&#x660E;&quot;</span>, <span class="hljs-string">&quot;main2.xml&quot;</span>);

    ui.setViewValue(ui.name,<span class="hljs-string">&quot;&#x6211;&#x662F;name&quot;</span>);
    <span class="hljs-comment">//&#x4FDD;&#x5B58;&#x6240;&#x6709;&#x7684;&#x503C;</span>
    ui.saveAllConfig();

    <span class="hljs-comment">//&#x5355;&#x72EC;&#x4FDD;&#x5B58;&#x67D0;&#x4E9B;&#x503C;</span>
    ui.saveConfig(<span class="hljs-string">&quot;sex&quot;</span>,<span class="hljs-string">&quot;&#x5973;&#x540C;&#x5B66;&quot;</span>);
    ui.saveConfig(<span class="hljs-string">&quot;music&quot;</span>,<span class="hljs-literal">true</span>);

    <span class="hljs-keyword">var</span> data = ui.getConfigJSON();
    ui.logd(<span class="hljs-string">&quot;data &quot;</span>+data);

    data= <span class="hljs-built_in">JSON</span>.parse(data);
    <span class="hljs-comment">//&#x6253;&#x5370;name&#x7684;&#x503C;&#xFF0C;&#x5982;&#x679C;&#x6CA1;&#x6709;&#x503C;&#x8981;&#x5148;&#x4FDD;&#x5B58;&#x4E00;&#x4E0B;</span>
    ui.logd(data.name);
    <span class="hljs-comment">//&#x83B7;&#x53D6;&#x5355;&#x4E2A;&#x503C;</span>
    ui.logd(ui.getConfig(<span class="hljs-string">&quot;name&quot;</span>));
}

main();
</code></pre>
</blockquote>
<h3 id="&#x4FDD;&#x5B58;&#x6240;&#x6709;ui&#x503C;-saveallconfig"><a name="&#x4FDD;&#x5B58;&#x6240;&#x6709;ui&#x503C;-saveallconfig" class="anchor-navigation-ex-anchor" href="#&#x4FDD;&#x5B58;&#x6240;&#x6709;ui&#x503C;-saveallconfig"><i class="fa fa-link" aria-hidden="true"></i></a>4.4.10. &#x4FDD;&#x5B58;&#x6240;&#x6709;UI&#x503C; saveAllConfig</h3>
<ul>
<li>&#x6839;&#x636E;&#x8BBE;&#x7F6E;&#x7684;tag&#xFF0C;&#x4FDD;&#x5B58;&#x6240;&#x6709;&#x914D;&#x7F6E;</li>
<li>@return &#x5E03;&#x5C14;&#x578B; true &#x4FDD;&#x5B58;&#x6210;&#x529F;&#xFF0C;false &#x4FDD;&#x5B58;&#x5931;&#x8D25;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-comment">// xml&#x6587;&#x4EF6;&#x5728;layout&#x6587;&#x4EF6;&#x5939;&#x4E0B;</span>
    <span class="hljs-keyword">var</span> u1=ui.layout(<span class="hljs-string">&quot;&#x53C2;&#x6570;&#x8BF4;&#x660E;&quot;</span>, <span class="hljs-string">&quot;main.xml&quot;</span>);
    <span class="hljs-keyword">var</span> u2=ui.layout(<span class="hljs-string">&quot;&#x5176;&#x4ED6;&#x8BF4;&#x660E;&quot;</span>, <span class="hljs-string">&quot;main2.xml&quot;</span>);

    ui.setViewValue(ui.name,<span class="hljs-string">&quot;&#x6211;&#x662F;name&quot;</span>);
    <span class="hljs-comment">//&#x4FDD;&#x5B58;&#x6240;&#x6709;&#x7684;&#x503C;</span>
    ui.saveAllConfig();

    <span class="hljs-comment">//&#x5355;&#x72EC;&#x4FDD;&#x5B58;&#x67D0;&#x4E9B;&#x503C;</span>
    ui.saveConfig(<span class="hljs-string">&quot;sex&quot;</span>,<span class="hljs-string">&quot;&#x5973;&#x540C;&#x5B66;&quot;</span>);
    ui.saveConfig(<span class="hljs-string">&quot;music&quot;</span>,<span class="hljs-literal">true</span>);

    <span class="hljs-keyword">var</span> data = ui.getConfigJSON();
    ui.logd(<span class="hljs-string">&quot;data &quot;</span>+data);

    data= <span class="hljs-built_in">JSON</span>.parse(data);
    <span class="hljs-comment">//&#x6253;&#x5370;name&#x7684;&#x503C;&#xFF0C;&#x5982;&#x679C;&#x6CA1;&#x6709;&#x503C;&#x8981;&#x5148;&#x4FDD;&#x5B58;&#x4E00;&#x4E0B;</span>
    ui.logd(data.name);
}

main();
</code></pre>
</blockquote>
<h3 id="&#x4FDD;&#x5B58;&#x5355;&#x4E2A;ui&#x503C;-saveconfig"><a name="&#x4FDD;&#x5B58;&#x5355;&#x4E2A;ui&#x503C;-saveconfig" class="anchor-navigation-ex-anchor" href="#&#x4FDD;&#x5B58;&#x5355;&#x4E2A;ui&#x503C;-saveconfig"><i class="fa fa-link" aria-hidden="true"></i></a>4.4.11. &#x4FDD;&#x5B58;&#x5355;&#x4E2A;UI&#x503C; saveConfig</h3>
<ul>
<li>&#x4FDD;&#x5B58;UI&#x53C2;&#x6570;&#x503C;</li>
<li>@param key UI&#x7684;key</li>
<li>@param value UI&#x7684;&#x503C;</li>
<li>@return &#x5E03;&#x5C14;&#x578B; true&#x4EE3;&#x8868;&#x6210;&#x529F; false&#x4EE3;&#x8868;&#x5931;&#x8D25;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-comment">// xml&#x6587;&#x4EF6;&#x5728;layout&#x6587;&#x4EF6;&#x5939;&#x4E0B;</span>
    <span class="hljs-keyword">var</span> u1=ui.layout(<span class="hljs-string">&quot;&#x53C2;&#x6570;&#x8BF4;&#x660E;&quot;</span>, <span class="hljs-string">&quot;main.xml&quot;</span>);
    <span class="hljs-keyword">var</span> u2=ui.layout(<span class="hljs-string">&quot;&#x5176;&#x4ED6;&#x8BF4;&#x660E;&quot;</span>, <span class="hljs-string">&quot;main2.xml&quot;</span>);

    ui.setViewValue(ui.name,<span class="hljs-string">&quot;&#x6211;&#x662F;name&quot;</span>);
    <span class="hljs-comment">//&#x4FDD;&#x5B58;&#x6240;&#x6709;&#x7684;&#x503C;</span>
    ui.saveAllConfig();

    <span class="hljs-comment">//&#x5355;&#x72EC;&#x4FDD;&#x5B58;&#x67D0;&#x4E9B;&#x503C;</span>
    ui.saveConfig(<span class="hljs-string">&quot;sex&quot;</span>,<span class="hljs-string">&quot;&#x5973;&#x540C;&#x5B66;&quot;</span>);
    ui.saveConfig(<span class="hljs-string">&quot;music&quot;</span>,<span class="hljs-literal">true</span>);

    <span class="hljs-keyword">var</span> data = ui.getConfigJSON();
    ui.logd(<span class="hljs-string">&quot;data &quot;</span>+data);

    data= <span class="hljs-built_in">JSON</span>.parse(data);
    <span class="hljs-comment">//&#x6253;&#x5370;name&#x7684;&#x503C;&#xFF0C;&#x5982;&#x679C;&#x6CA1;&#x6709;&#x503C;&#x8981;&#x5148;&#x4FDD;&#x5B58;&#x4E00;&#x4E0B;</span>
    ui.logd(data.name);
}

main();
</code></pre>
</blockquote>
<h3 id="&#x8BFB;&#x53D6;&#x56FE;&#x50CF;&#x8D44;&#x6E90;-resresasdrawable"><a name="&#x8BFB;&#x53D6;&#x56FE;&#x50CF;&#x8D44;&#x6E90;-resresasdrawable" class="anchor-navigation-ex-anchor" href="#&#x8BFB;&#x53D6;&#x56FE;&#x50CF;&#x8D44;&#x6E90;-resresasdrawable"><i class="fa fa-link" aria-hidden="true"></i></a>4.4.12. &#x8BFB;&#x53D6;&#x56FE;&#x50CF;&#x8D44;&#x6E90; resResAsDrawable</h3>
<ul>
<li>&#x8BFB;&#x53D6;IEC&#x5305;&#x4E2D;&#x7684;res&#x6587;&#x4EF6;&#x5939;&#x67D0;&#x4E2A;&#x6587;&#x4EF6;&#x8D44;&#x6E90;&#xFF0C;&#x5E76;&#x53D8;&#x6210;android&#x7684;Drawable&#x5BF9;&#x8C61;&#x8FD4;&#x56DE;</li>
<li>@param path res&#x6587;&#x4EF6;&#x5939;&#x4E2D;&#x7684;&#x8D44;&#x6E90;&#x6587;&#x4EF6;&#x8DEF;&#x5F84;</li>
<li>@return Drawable &#x56FE;&#x50CF;&#x5BF9;&#x8C61;&#x6216;&#x8005;null</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-comment">// xml&#x6587;&#x4EF6;&#x5728;layout&#x6587;&#x4EF6;&#x5939;&#x4E0B;</span>
    <span class="hljs-keyword">var</span> u1=ui.layout(<span class="hljs-string">&quot;&#x53C2;&#x6570;&#x8BF4;&#x660E;&quot;</span>, <span class="hljs-string">&quot;main.xml&quot;</span>);
    <span class="hljs-keyword">var</span> u2=ui.layout(<span class="hljs-string">&quot;&#x5176;&#x4ED6;&#x8BF4;&#x660E;&quot;</span>, <span class="hljs-string">&quot;main2.xml&quot;</span>);

    <span class="hljs-comment">//checkbox.png &#x5B58;&#x653E;&#x5728;res&#x6587;&#x4EF6;&#x5939;&#x4E0B;</span>
    <span class="hljs-keyword">var</span> bg = ui.resResAsDrawable(<span class="hljs-string">&quot;checkbox.png&quot;</span>);
    <span class="hljs-comment">//&#x8BBE;&#x7F6E;&#x52A8;&#x6001;&#x80CC;&#x666F;&#x8272;</span>
    ui.music.setBackgroundDrawable(bg);
    <span class="hljs-comment">//&#x8BBE;&#x7F6E;&#x6309;&#x94AE;&#x7684;&#x80CC;&#x666F;</span>
    ui.music.setButtonDrawable(bg);

}

main();
</code></pre>
</blockquote>
<h2 id="&#x6D6E;&#x7A97;&#x7C7B;"><a name="&#x6D6E;&#x7A97;&#x7C7B;" class="anchor-navigation-ex-anchor" href="#&#x6D6E;&#x7A97;&#x7C7B;"><i class="fa fa-link" aria-hidden="true"></i></a>4.5. &#x6D6E;&#x7A97;&#x7C7B;</h2>
<h3 id="&#x6D6E;&#x7A97;&#x6743;&#x9650;-hasfloatviewpermission"><a name="&#x6D6E;&#x7A97;&#x6743;&#x9650;-hasfloatviewpermission" class="anchor-navigation-ex-anchor" href="#&#x6D6E;&#x7A97;&#x6743;&#x9650;-hasfloatviewpermission"><i class="fa fa-link" aria-hidden="true"></i></a>4.5.1. &#x6D6E;&#x7A97;&#x6743;&#x9650; hasFloatViewPermission</h3>
<ul>
<li>&#x662F;&#x5426;&#x6709;&#x6D6E;&#x7A97;&#x6743;&#x9650;</li>
<li>@return &#x5E03;&#x5C14;&#x578B; true&#x4EE3;&#x8868;&#x6709;&#x6743;&#x9650; false&#x4EE3;&#x8868;&#x65E0;&#x6743;&#x9650;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript">
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-keyword">var</span> r = ui.hasFloatViewPermission();
    <span class="hljs-keyword">if</span> (!r) {
        <span class="hljs-keyword">var</span> req = ui.requestFloatViewPermission(<span class="hljs-number">10000</span>);
        ui.logd(<span class="hljs-string">&quot;&#x7533;&#x8BF7;&#x6D6E;&#x7A97;&#x6743;&#x9650;: &quot;</span>+req);
    }
    r = ui.hasFloatViewPermission();
    ui.logd(<span class="hljs-string">&quot;&#x662F;&#x5426;&#x6709;&#x6D6E;&#x7A97;&#x6743;&#x9650;: &quot;</span>+r);

}

main();
</code></pre>
</blockquote>
<h3 id="&#x8BF7;&#x6C42;&#x6D6E;&#x7A97;&#x6743;&#x9650;-requestfloatviewpermissionasync"><a name="&#x8BF7;&#x6C42;&#x6D6E;&#x7A97;&#x6743;&#x9650;-requestfloatviewpermissionasync" class="anchor-navigation-ex-anchor" href="#&#x8BF7;&#x6C42;&#x6D6E;&#x7A97;&#x6743;&#x9650;-requestfloatviewpermissionasync"><i class="fa fa-link" aria-hidden="true"></i></a>4.5.2. &#x8BF7;&#x6C42;&#x6D6E;&#x7A97;&#x6743;&#x9650; requestFloatViewPermissionAsync</h3>
<ul>
<li>&#x5F02;&#x6B65;&#x8BF7;&#x6C42;&#x6D6E;&#x7A97;&#x6743;&#x9650;</li>
<li>@param timeout &#x8D85;&#x65F6;&#x65F6;&#x95F4;</li>
<li>@param callback &#x56DE;&#x8C03;&#x51FD;&#x6570;</li>
<li>@return &#x5E03;&#x5C14;&#x578B; true&#x4EE3;&#x8868;&#x6709;&#x6743;&#x9650; false&#x4EE3;&#x8868;&#x65E0;&#x6743;&#x9650;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-keyword">var</span> r = ui.hasFloatViewPermission();
    <span class="hljs-keyword">if</span> (!r) {
        ui.requestFloatViewPermissionAsync(<span class="hljs-number">20000</span>,<span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">r</span>)</span>{
           ui.logd(<span class="hljs-string">&quot;&#x7533;&#x8BF7;&#x6D6E;&#x7A97;&#x6743;&#x9650;: &quot;</span>+r);
        });

    }
    r = ui.hasFloatViewPermission();
    ui.logd(<span class="hljs-string">&quot;&#x662F;&#x5426;&#x6709;&#x6D6E;&#x7A97;&#x6743;&#x9650;: &quot;</span>+r);

}

main();
</code></pre>
</blockquote>
<h3 id="&#x5C55;&#x793A;&#x65E5;&#x5FD7;&#x6D6E;&#x7A97;-showlogwindow"><a name="&#x5C55;&#x793A;&#x65E5;&#x5FD7;&#x6D6E;&#x7A97;-showlogwindow" class="anchor-navigation-ex-anchor" href="#&#x5C55;&#x793A;&#x65E5;&#x5FD7;&#x6D6E;&#x7A97;-showlogwindow"><i class="fa fa-link" aria-hidden="true"></i></a>4.5.3. &#x5C55;&#x793A;&#x65E5;&#x5FD7;&#x6D6E;&#x7A97; showLogWindow</h3>
<ul>
<li>&#x663E;&#x793A;&#x65E5;&#x5FD7;&#x6D6E;&#x7A97;</li>
<li>@return &#x5E03;&#x5C14;&#x578B; true&#x4EE3;&#x8868;&#x6210;&#x529F;&#xFF0C;false&#x4EE3;&#x8868;&#x5931;&#x8D25;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-keyword">var</span> r = ui.hasFloatViewPermission();
    ui.logd(<span class="hljs-string">&quot;&#x662F;&#x5426;&#x6709;&#x6D6E;&#x7A97;&#x6743;&#x9650;:&quot;</span>+r)
    <span class="hljs-keyword">if</span> (!r) {
        <span class="hljs-keyword">return</span>
    }
    <span class="hljs-comment">//&#x5C55;&#x793A;&#x6D6E;&#x7A97;</span>
    ui.showLogWindow();
    ui.logd(<span class="hljs-string">&quot;&#x663E;&#x793A;&#x6D88;&#x606F;&quot;</span>)
    <span class="hljs-comment">//3&#x79D2;&#x540E;&#x5728;UI&#x7EBF;&#x7A0B;&#x6D88;&#x5931;&#x6389;</span>
    ui.getHandler().postDelayed(<span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>)</span>{
       ui.closeLogWindow();
    },<span class="hljs-number">3000</span>);
}

main();
</code></pre>
</blockquote>
<h3 id="&#x5173;&#x95ED;&#x65E5;&#x5FD7;&#x6D6E;&#x7A97;-closelogwindow"><a name="&#x5173;&#x95ED;&#x65E5;&#x5FD7;&#x6D6E;&#x7A97;-closelogwindow" class="anchor-navigation-ex-anchor" href="#&#x5173;&#x95ED;&#x65E5;&#x5FD7;&#x6D6E;&#x7A97;-closelogwindow"><i class="fa fa-link" aria-hidden="true"></i></a>4.5.4. &#x5173;&#x95ED;&#x65E5;&#x5FD7;&#x6D6E;&#x7A97; closeLogWindow</h3>
<ul>
<li>&#x5173;&#x95ED;&#x65E5;&#x5FD7;&#x6D6E;&#x7A97;</li>
<li>@return &#x5E03;&#x5C14;&#x578B; true&#x4EE3;&#x8868;&#x6210;&#x529F;&#xFF0C;false&#x4EE3;&#x8868;&#x5931;&#x8D25;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-keyword">var</span> r = ui.hasFloatViewPermission();
    ui.logd(<span class="hljs-string">&quot;&#x662F;&#x5426;&#x6709;&#x6D6E;&#x7A97;&#x6743;&#x9650;:&quot;</span>+r)
    <span class="hljs-keyword">if</span> (!r) {
        <span class="hljs-keyword">return</span>
    }
    <span class="hljs-comment">//&#x5C55;&#x793A;&#x6D6E;&#x7A97;</span>
    ui.showLogWindow();
    ui.logd(<span class="hljs-string">&quot;&#x663E;&#x793A;&#x6D88;&#x606F;&quot;</span>)
    <span class="hljs-comment">//3&#x79D2;&#x540E;&#x5728;UI&#x7EBF;&#x7A0B;&#x6D88;&#x5931;&#x6389;</span>
    ui.getHandler().postDelayed(<span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>)</span>{
       ui.closeLogWindow();
    },<span class="hljs-number">3000</span>);
}

main();
</code></pre>
</blockquote>
<h2 id="&#x811A;&#x672C;&#x542F;&#x52A8;"><a name="&#x811A;&#x672C;&#x542F;&#x52A8;" class="anchor-navigation-ex-anchor" href="#&#x811A;&#x672C;&#x542F;&#x52A8;"><i class="fa fa-link" aria-hidden="true"></i></a>4.6. &#x811A;&#x672C;&#x542F;&#x52A8;</h2>
<h3 id="&#x662F;&#x5426;&#x662F;&#x65E0;&#x969C;&#x788D;&#x6A21;&#x5F0F;-isaccmode"><a name="&#x662F;&#x5426;&#x662F;&#x65E0;&#x969C;&#x788D;&#x6A21;&#x5F0F;-isaccmode" class="anchor-navigation-ex-anchor" href="#&#x662F;&#x5426;&#x662F;&#x65E0;&#x969C;&#x788D;&#x6A21;&#x5F0F;-isaccmode"><i class="fa fa-link" aria-hidden="true"></i></a>4.6.1. &#x662F;&#x5426;&#x662F;&#x65E0;&#x969C;&#x788D;&#x6A21;&#x5F0F; isAccMode</h3>
<ul>
<li>&#x662F;&#x5426;&#x662F;&#x65E0;&#x969C;&#x788D;&#x8FD0;&#x884C;&#x6A21;&#x5F0F;</li>
<li>@return &#x5E03;&#x5C14;&#x578B; true &#x662F; false &#x5426;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
  ui.logd(<span class="hljs-string">&quot;&#x65E0;&#x969C;&#x788D;&#x6A21;&#x5F0F;: &quot;</span>+ui.isAccMode());
  ui.logd(<span class="hljs-string">&quot;&#x4EE3;&#x7406;&#x6A21;&#x5F0F;: &quot;</span>+ui.isAgentMode());

  <span class="hljs-comment">// &#x8BBE;&#x7F6E;&#x8FD0;&#x884C;&#x6A21;&#x5F0F;</span>
  ui.setRunningMode(<span class="hljs-number">1</span>);

  ui.logd(<span class="hljs-string">&quot;&#x65E0;&#x969C;&#x788D;&#x6A21;&#x5F0F;: &quot;</span>+ui.isAccMode());
  ui.logd(<span class="hljs-string">&quot;&#x4EE3;&#x7406;&#x6A21;&#x5F0F;: &quot;</span>+ui.isAgentMode());
}

main();
</code></pre>
</blockquote>
<h3 id="&#x662F;&#x5426;&#x662F;&#x4EE3;&#x7406;&#x6A21;&#x5F0F;-isagentmode"><a name="&#x662F;&#x5426;&#x662F;&#x4EE3;&#x7406;&#x6A21;&#x5F0F;-isagentmode" class="anchor-navigation-ex-anchor" href="#&#x662F;&#x5426;&#x662F;&#x4EE3;&#x7406;&#x6A21;&#x5F0F;-isagentmode"><i class="fa fa-link" aria-hidden="true"></i></a>4.6.2. &#x662F;&#x5426;&#x662F;&#x4EE3;&#x7406;&#x6A21;&#x5F0F; isAgentMode</h3>
<ul>
<li>&#x662F;&#x5426;&#x662F;&#x4EE3;&#x7406;&#x8FD0;&#x884C;&#x6A21;&#x5F0F;</li>
<li>@return &#x5E03;&#x5C14;&#x578B; true &#x662F; false &#x5426;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
  ui.logd(<span class="hljs-string">&quot;&#x65E0;&#x969C;&#x788D;&#x6A21;&#x5F0F;: &quot;</span>+ui.isAccMode());
  ui.logd(<span class="hljs-string">&quot;&#x4EE3;&#x7406;&#x6A21;&#x5F0F;: &quot;</span>+ui.isAgentMode());

  <span class="hljs-comment">// &#x8BBE;&#x7F6E;&#x8FD0;&#x884C;&#x6A21;&#x5F0F;</span>
  ui.setRunningMode(<span class="hljs-number">1</span>);

  ui.logd(<span class="hljs-string">&quot;&#x65E0;&#x969C;&#x788D;&#x6A21;&#x5F0F;: &quot;</span>+ui.isAccMode());
  ui.logd(<span class="hljs-string">&quot;&#x4EE3;&#x7406;&#x6A21;&#x5F0F;: &quot;</span>+ui.isAgentMode());
}

main();
</code></pre>
</blockquote>
<h3 id="&#x81EA;&#x52A8;&#x5316;&#x670D;&#x52A1;&#x662F;&#x5426;&#x6B63;&#x5E38;-isserviceok"><a name="&#x81EA;&#x52A8;&#x5316;&#x670D;&#x52A1;&#x662F;&#x5426;&#x6B63;&#x5E38;-isserviceok" class="anchor-navigation-ex-anchor" href="#&#x81EA;&#x52A8;&#x5316;&#x670D;&#x52A1;&#x662F;&#x5426;&#x6B63;&#x5E38;-isserviceok"><i class="fa fa-link" aria-hidden="true"></i></a>4.6.3. &#x81EA;&#x52A8;&#x5316;&#x670D;&#x52A1;&#x662F;&#x5426;&#x6B63;&#x5E38; isServiceOk</h3>
<ul>
<li>&#x81EA;&#x52A8;&#x5316;&#x670D;&#x52A1;&#x662F;&#x5426;&#x6B63;&#x5E38;</li>
<li>@return &#x5E03;&#x5C14;&#x578B; true &#x662F; false &#x5426;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
  ui.logd(<span class="hljs-string">&quot;&#x65E0;&#x969C;&#x788D;&#x6A21;&#x5F0F;: &quot;</span>+ui.isAccMode());
  ui.logd(<span class="hljs-string">&quot;&#x4EE3;&#x7406;&#x6A21;&#x5F0F;: &quot;</span>+ui.isAgentMode());

  <span class="hljs-comment">// &#x8BBE;&#x7F6E;&#x8FD0;&#x884C;&#x6A21;&#x5F0F;</span>
  ui.setRunningMode(<span class="hljs-number">1</span>);

  ui.logd(<span class="hljs-string">&quot;&#x65E0;&#x969C;&#x788D;&#x6A21;&#x5F0F;: &quot;</span>+ui.isAccMode());
  ui.logd(<span class="hljs-string">&quot;&#x4EE3;&#x7406;&#x6A21;&#x5F0F;: &quot;</span>+ui.isAgentMode());


  <span class="hljs-keyword">var</span> ok = ui.isServiceOk();
  <span class="hljs-keyword">if</span> (!ok) {
    ui.startEnvAsync(<span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">r</span>) </span>{
          ui.logd(<span class="hljs-string">&quot;&#x542F;&#x52A8;&#x73AF;&#x5883;&#x7ED3;&#x679C;: &quot;</span> + r);

      });
  }
}

main();
</code></pre>
</blockquote>
<h3 id="&#x8BBE;&#x7F6E;&#x8FD0;&#x884C;&#x6A21;&#x5F0F;-setrunningmode"><a name="&#x8BBE;&#x7F6E;&#x8FD0;&#x884C;&#x6A21;&#x5F0F;-setrunningmode" class="anchor-navigation-ex-anchor" href="#&#x8BBE;&#x7F6E;&#x8FD0;&#x884C;&#x6A21;&#x5F0F;-setrunningmode"><i class="fa fa-link" aria-hidden="true"></i></a>4.6.4. &#x8BBE;&#x7F6E;&#x8FD0;&#x884C;&#x6A21;&#x5F0F; setRunningMode</h3>
<ul>
<li>&#x8BBE;&#x7F6E;&#x8FD0;&#x884C;&#x6A21;&#x5F0F;</li>
<li>@param mode 1 &#x4EE3;&#x8868;&#x662F;&#x4EE3;&#x7406;&#x6A21;&#x5F0F;  2 &#x4EE3;&#x8868;&#x65E0;&#x969C;&#x788D;&#x6A21;&#x5F0F;</li>
<li>@return &#x5E03;&#x5C14;&#x578B; true &#x662F; false &#x5426;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
  ui.logd(<span class="hljs-string">&quot;&#x65E0;&#x969C;&#x788D;&#x6A21;&#x5F0F;: &quot;</span>+ui.isAccMode());
  ui.logd(<span class="hljs-string">&quot;&#x4EE3;&#x7406;&#x6A21;&#x5F0F;: &quot;</span>+ui.isAgentMode());

  <span class="hljs-comment">// &#x8BBE;&#x7F6E;&#x8FD0;&#x884C;&#x6A21;&#x5F0F;</span>
  ui.setRunningMode(<span class="hljs-number">1</span>);

  ui.logd(<span class="hljs-string">&quot;&#x65E0;&#x969C;&#x788D;&#x6A21;&#x5F0F;: &quot;</span>+ui.isAccMode());
  ui.logd(<span class="hljs-string">&quot;&#x4EE3;&#x7406;&#x6A21;&#x5F0F;: &quot;</span>+ui.isAgentMode());
}

main();
</code></pre>
</blockquote>
<h3 id="&#x5F02;&#x6B65;&#x542F;&#x52A8;&#x81EA;&#x52A8;&#x5316;&#x73AF;&#x5883;-startenvasync"><a name="&#x5F02;&#x6B65;&#x542F;&#x52A8;&#x81EA;&#x52A8;&#x5316;&#x73AF;&#x5883;-startenvasync" class="anchor-navigation-ex-anchor" href="#&#x5F02;&#x6B65;&#x542F;&#x52A8;&#x81EA;&#x52A8;&#x5316;&#x73AF;&#x5883;-startenvasync"><i class="fa fa-link" aria-hidden="true"></i></a>4.6.5. &#x5F02;&#x6B65;&#x542F;&#x52A8;&#x81EA;&#x52A8;&#x5316;&#x73AF;&#x5883; startEnvAsync</h3>
<ul>
<li>&#x542F;&#x52A8;&#x73AF;&#x5883;</li>
<li>@return &#x5E03;&#x5C14;&#x578B; true&#x4EE3;&#x8868;&#x542F;&#x52A8;&#x6210;&#x529F;&#xFF0C;false&#x4EE3;&#x8868;&#x542F;&#x52A8;&#x5931;&#x8D25;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">var</span> ok = ui.isServiceOk();
  <span class="hljs-keyword">if</span> (!ok) {
    ui.startEnvAsync(<span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">r</span>) </span>{
          ui.logd(<span class="hljs-string">&quot;&#x542F;&#x52A8;&#x73AF;&#x5883;&#x7ED3;&#x679C;: &quot;</span> + r);
      });
  }
}

main();
</code></pre>
</blockquote>
<h3 id="&#x542F;&#x52A8;&#x6D4B;&#x8BD5;&#x811A;&#x672C;-start"><a name="&#x542F;&#x52A8;&#x6D4B;&#x8BD5;&#x811A;&#x672C;-start" class="anchor-navigation-ex-anchor" href="#&#x542F;&#x52A8;&#x6D4B;&#x8BD5;&#x811A;&#x672C;-start"><i class="fa fa-link" aria-hidden="true"></i></a>4.6.6. &#x542F;&#x52A8;&#x6D4B;&#x8BD5;&#x811A;&#x672C; start</h3>
<ul>
<li>&#x542F;&#x52A8;&#x811A;&#x672C;</li>
<li>@return &#x5E03;&#x5C14;&#x578B; true&#x4EE3;&#x8868;&#x542F;&#x52A8;&#x6210;&#x529F;&#xFF0C;false&#x4EE3;&#x8868;&#x542F;&#x52A8;&#x5931;&#x8D25;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
  ui.layout(<span class="hljs-string">&quot;&#x53C2;&#x6570;&#x8BBE;&#x7F6E;&quot;</span>, <span class="hljs-string">&quot;main.xml&quot;</span>);
  <span class="hljs-comment">//xml&#x4E2D;&#x6709;&#x4E2A;tag=startBtn&#x7684;&#x6309;&#x94AE;</span>
   <span class="hljs-comment">//&#x542F;&#x52A8;&#x811A;&#x672C;&#x6309;&#x94AE;</span>
      ui.setEvent(ui.startBtn, <span class="hljs-string">&quot;click&quot;</span>, <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">view</span>) </span>{
          ui.start();
      });
}

main();
</code></pre>
</blockquote>
<h3 id="&#x505C;&#x6B62;&#x6D4B;&#x8BD5;&#x811A;&#x672C;-stoptask"><a name="&#x505C;&#x6B62;&#x6D4B;&#x8BD5;&#x811A;&#x672C;-stoptask" class="anchor-navigation-ex-anchor" href="#&#x505C;&#x6B62;&#x6D4B;&#x8BD5;&#x811A;&#x672C;-stoptask"><i class="fa fa-link" aria-hidden="true"></i></a>4.6.7. &#x505C;&#x6B62;&#x6D4B;&#x8BD5;&#x811A;&#x672C; stopTask</h3>
<ul>
<li>&#x505C;&#x6B62;&#x6D4B;&#x8BD5;&#x811A;&#x672C;</li>
<li>@return &#x5E03;&#x5C14;&#x578B; true&#x4EE3;&#x8868;&#x542F;&#x52A8;&#x6210;&#x529F;&#xFF0C;false&#x4EE3;&#x8868;&#x542F;&#x52A8;&#x5931;&#x8D25;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
  ui.layout(<span class="hljs-string">&quot;&#x53C2;&#x6570;&#x8BBE;&#x7F6E;&quot;</span>, <span class="hljs-string">&quot;main.xml&quot;</span>);
  <span class="hljs-comment">//xml&#x4E2D;&#x6709;&#x4E2A;tag=stopBtn&#x7684;&#x6309;&#x94AE;</span>
   <span class="hljs-comment">//&#x542F;&#x52A8;&#x811A;&#x672C;&#x6309;&#x94AE;</span>
      ui.setEvent(ui.stopBtn, <span class="hljs-string">&quot;click&quot;</span>, <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">view</span>) </span>{
          ui.stopTask();
      });
}

main();
</code></pre>
</blockquote>
<h2 id="&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;"><a name="&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;" class="anchor-navigation-ex-anchor" href="#&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;"><i class="fa fa-link" aria-hidden="true"></i></a>4.7. &#x5B9A;&#x65F6;&#x4EFB;&#x52A1;</h2>
<h3 id="&#x5F00;&#x542F;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;-startjob"><a name="&#x5F00;&#x542F;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;-startjob" class="anchor-navigation-ex-anchor" href="#&#x5F00;&#x542F;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;-startjob"><i class="fa fa-link" aria-hidden="true"></i></a>4.7.1. &#x5F00;&#x542F;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1; startJob</h3>
<ul>
<li>&#x5F00;&#x542F;&#x4E00;&#x4E2A;&#x5B9A;&#x65F6;&#x811A;&#x672C;&#x4EFB;&#x52A1;</li>
<li>@param tag &#x4EFB;&#x52A1;&#x7684;&#x552F;&#x4E00;&#x6807;&#x793A;&#xFF0C;&#x4E0D;&#x80FD;&#x4E3A;&#x7A7A;&#xFF0C;&#x811A;&#x672C;&#x4E2D;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;readConfigString(&quot;jobTaskTag&quot;)&#x83B7;&#x53D6;&#x5F53;&#x524D;tag&#x503C;&#xFF0C;&#x5224;&#x65AD;&#x662F;&#x90A3;&#x4E2A;&#x4EFB;&#x52A1;&#x8FC7;&#x6765;&#x6267;&#x884C;&#x7684;</li>
<li>@param execTime &#x5B9A;&#x65F6;&#x65F6;&#x95F4;&#x683C;&#x5F0F;: 2020-04-17 19:20:00&#xFF0C;&#x6216;&#x8005;&#x76F4;&#x63A5;&#x662F;&#x79D2;&#x6570;&#x5B57;&#xFF0C;&#x4F8B;&#x5982; 3&#xFF0C;&#x4EE3;&#x8868;3&#x79D2;&#x540E;</li>
<li>@param cancelBeforeRunning</li>
<li>@return &#x6574;&#x578B; jobid</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">var</span> set = ui.layout(<span class="hljs-string">&quot;&#x53C2;&#x6570;&#x8BBE;&#x7F6E;&quot;</span>, <span class="hljs-string">&quot;main.xml&quot;</span>);
  <span class="hljs-comment">//&#x6309;&#x7167;&#x65E5;&#x5FD7;&#x5B9A;&#x65F6;&#x7684;&#x4EFB;&#x52A1;</span>
  <span class="hljs-keyword">var</span> time=<span class="hljs-string">&quot;2020-05-15 15:47:00&quot;</span>;
  <span class="hljs-keyword">var</span> tag=<span class="hljs-string">&quot;job1&quot;</span>;
  <span class="hljs-keyword">var</span> jobid = ui.startJob(tag,time,<span class="hljs-literal">true</span>);
  ui.logd(<span class="hljs-string">&quot;&#x6309;&#x7167;&#x65E5;&#x5FD7;&#x5B9A;&#x65F6;&#x7684;&#x4EFB;&#x52A1;:&quot;</span>+jobid)

   <span class="hljs-comment">//&#x6309;&#x7167;&#x591A;&#x5C11;&#x79D2;&#x6267;&#x884C;</span>
 <span class="hljs-keyword">var</span> time2=<span class="hljs-string">&quot;10&quot;</span>;
  <span class="hljs-keyword">var</span> tag2=<span class="hljs-string">&quot;job2&quot;</span>;
  <span class="hljs-keyword">var</span> jobid2 = ui.startJob(tag2,time2,<span class="hljs-literal">false</span>);
  ui.logd(<span class="hljs-string">&quot;&#x6309;&#x7167;&#x591A;&#x5C11;&#x79D2;&#x6267;&#x884C;:&quot;</span>+jobid2)

  <span class="hljs-keyword">var</span> tags=ui.getAllJobTag();
  ui.logd(<span class="hljs-string">&quot;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;&#x7684;&#x6807;&#x7B7E;:&quot;</span>+tags)

  <span class="hljs-comment">//&#x53D6;&#x6D88;&#x4EFB;&#x52A1;</span>
   ui.cancelAllJob();
   <span class="hljs-comment">//&#x6309;&#x7167;&#x6807;&#x7B7E;&#x53D6;&#x6D88;&#x4EFB;&#x52A1;</span>
   ui.cancelJob(<span class="hljs-string">&quot;job2&quot;</span>);
}

main();
</code></pre>
</blockquote>
<h3 id="&#x53D6;&#x6D88;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;-canceljob"><a name="&#x53D6;&#x6D88;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;-canceljob" class="anchor-navigation-ex-anchor" href="#&#x53D6;&#x6D88;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;-canceljob"><i class="fa fa-link" aria-hidden="true"></i></a>4.7.2. &#x53D6;&#x6D88;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1; cancelJob</h3>
<ul>
<li>&#x53D6;&#x6D88;&#x6307;&#x5B9A;&#x6807;&#x7B7E;&#x7684;&#x4EFB;&#x52A1;</li>
<li>@param tag &#x6807;&#x7B7E;</li>
<li>@return &#x5E03;&#x5C14;&#x578B; true&#x4EE3;&#x8868;&#x6210;&#x529F;&#xFF0C;false&#x4EE3;&#x8868;&#x5931;&#x8D25;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">var</span> set = ui.layout(<span class="hljs-string">&quot;&#x53C2;&#x6570;&#x8BBE;&#x7F6E;&quot;</span>, <span class="hljs-string">&quot;main.xml&quot;</span>);
  <span class="hljs-comment">//&#x6309;&#x7167;&#x65E5;&#x5FD7;&#x5B9A;&#x65F6;&#x7684;&#x4EFB;&#x52A1;</span>
  <span class="hljs-keyword">var</span> time=<span class="hljs-string">&quot;2020-05-15 15:47:00&quot;</span>;
  <span class="hljs-keyword">var</span> tag=<span class="hljs-string">&quot;job1&quot;</span>;
  <span class="hljs-keyword">var</span> jobid = ui.startJob(tag,time,<span class="hljs-literal">true</span>);
  ui.logd(<span class="hljs-string">&quot;&#x6309;&#x7167;&#x65E5;&#x5FD7;&#x5B9A;&#x65F6;&#x7684;&#x4EFB;&#x52A1;:&quot;</span>+jobid)

   <span class="hljs-comment">//&#x6309;&#x7167;&#x591A;&#x5C11;&#x79D2;&#x6267;&#x884C;</span>
 <span class="hljs-keyword">var</span> time2=<span class="hljs-string">&quot;10&quot;</span>;
  <span class="hljs-keyword">var</span> tag2=<span class="hljs-string">&quot;job2&quot;</span>;
  <span class="hljs-keyword">var</span> jobid2 = ui.startJob(tag2,time2,<span class="hljs-literal">false</span>);
  ui.logd(<span class="hljs-string">&quot;&#x6309;&#x7167;&#x591A;&#x5C11;&#x79D2;&#x6267;&#x884C;:&quot;</span>+jobid2)

  <span class="hljs-keyword">var</span> tags=ui.getAllJobTag();
  ui.logd(<span class="hljs-string">&quot;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;&#x7684;&#x6807;&#x7B7E;:&quot;</span>+tags)

  <span class="hljs-comment">//&#x53D6;&#x6D88;&#x4EFB;&#x52A1;</span>
   ui.cancelAllJob();
   <span class="hljs-comment">//&#x6309;&#x7167;&#x6807;&#x7B7E;&#x53D6;&#x6D88;&#x4EFB;&#x52A1;</span>
   ui.cancelJob(<span class="hljs-string">&quot;job2&quot;</span>);
}

main();
</code></pre>
</blockquote>
<h3 id="&#x53D6;&#x6D88;&#x6240;&#x6709;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;-cancelalljob"><a name="&#x53D6;&#x6D88;&#x6240;&#x6709;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;-cancelalljob" class="anchor-navigation-ex-anchor" href="#&#x53D6;&#x6D88;&#x6240;&#x6709;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;-cancelalljob"><i class="fa fa-link" aria-hidden="true"></i></a>4.7.3. &#x53D6;&#x6D88;&#x6240;&#x6709;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1; cancelAllJob</h3>
<ul>
<li>&#x53D6;&#x6D88;&#x6240;&#x6709;&#x7684;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;</li>
<li>@return &#x5E03;&#x5C14;&#x578B; true&#x4EE3;&#x8868;&#x6210;&#x529F;&#xFF0C;false&#x4EE3;&#x8868;&#x5931;&#x8D25;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">var</span> set = ui.layout(<span class="hljs-string">&quot;&#x53C2;&#x6570;&#x8BBE;&#x7F6E;&quot;</span>, <span class="hljs-string">&quot;main.xml&quot;</span>);
  <span class="hljs-comment">//&#x6309;&#x7167;&#x65E5;&#x5FD7;&#x5B9A;&#x65F6;&#x7684;&#x4EFB;&#x52A1;</span>
  <span class="hljs-keyword">var</span> time=<span class="hljs-string">&quot;2020-05-15 15:47:00&quot;</span>;
  <span class="hljs-keyword">var</span> tag=<span class="hljs-string">&quot;job1&quot;</span>;
  <span class="hljs-keyword">var</span> jobid = ui.startJob(tag,time,<span class="hljs-literal">true</span>);
  ui.logd(<span class="hljs-string">&quot;&#x6309;&#x7167;&#x65E5;&#x5FD7;&#x5B9A;&#x65F6;&#x7684;&#x4EFB;&#x52A1;:&quot;</span>+jobid)

   <span class="hljs-comment">//&#x6309;&#x7167;&#x591A;&#x5C11;&#x79D2;&#x6267;&#x884C;</span>
 <span class="hljs-keyword">var</span> time2=<span class="hljs-string">&quot;10&quot;</span>;
  <span class="hljs-keyword">var</span> tag2=<span class="hljs-string">&quot;job2&quot;</span>;
  <span class="hljs-keyword">var</span> jobid2 = ui.startJob(tag2,time2,<span class="hljs-literal">false</span>);
  ui.logd(<span class="hljs-string">&quot;&#x6309;&#x7167;&#x591A;&#x5C11;&#x79D2;&#x6267;&#x884C;:&quot;</span>+jobid2)

  <span class="hljs-keyword">var</span> tags=ui.getAllJobTag();
  ui.logd(<span class="hljs-string">&quot;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;&#x7684;&#x6807;&#x7B7E;:&quot;</span>+tags)

  <span class="hljs-comment">//&#x53D6;&#x6D88;&#x4EFB;&#x52A1;</span>
   ui.cancelAllJob();
   <span class="hljs-comment">//&#x6309;&#x7167;&#x6807;&#x7B7E;&#x53D6;&#x6D88;&#x4EFB;&#x52A1;</span>
   ui.cancelJob(<span class="hljs-string">&quot;job2&quot;</span>);
}

main();
</code></pre>
</blockquote>
<h3 id="&#x6240;&#x6709;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;&#x6807;&#x7B7E;-getalljobtag"><a name="&#x6240;&#x6709;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;&#x6807;&#x7B7E;-getalljobtag" class="anchor-navigation-ex-anchor" href="#&#x6240;&#x6709;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;&#x6807;&#x7B7E;-getalljobtag"><i class="fa fa-link" aria-hidden="true"></i></a>4.7.4. &#x6240;&#x6709;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;&#x6807;&#x7B7E; getAllJobTag</h3>
<ul>
<li>&#x83B7;&#x53D6;&#x6240;&#x6709;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;TAG</li>
<li>@return JSON&#x5B57;&#x7B26;&#x4E32;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">var</span> set = ui.layout(<span class="hljs-string">&quot;&#x53C2;&#x6570;&#x8BBE;&#x7F6E;&quot;</span>, <span class="hljs-string">&quot;main.xml&quot;</span>);
  <span class="hljs-comment">//&#x6309;&#x7167;&#x65E5;&#x5FD7;&#x5B9A;&#x65F6;&#x7684;&#x4EFB;&#x52A1;</span>
  <span class="hljs-keyword">var</span> time=<span class="hljs-string">&quot;2020-05-15 15:47:00&quot;</span>;
  <span class="hljs-keyword">var</span> tag=<span class="hljs-string">&quot;job1&quot;</span>;
  <span class="hljs-keyword">var</span> jobid = ui.startJob(tag,time,<span class="hljs-literal">true</span>);
  ui.logd(<span class="hljs-string">&quot;&#x6309;&#x7167;&#x65E5;&#x5FD7;&#x5B9A;&#x65F6;&#x7684;&#x4EFB;&#x52A1;:&quot;</span>+jobid)

   <span class="hljs-comment">//&#x6309;&#x7167;&#x591A;&#x5C11;&#x79D2;&#x6267;&#x884C;</span>
 <span class="hljs-keyword">var</span> time2=<span class="hljs-string">&quot;10&quot;</span>;
  <span class="hljs-keyword">var</span> tag2=<span class="hljs-string">&quot;job2&quot;</span>;
  <span class="hljs-keyword">var</span> jobid2 = ui.startJob(tag2,time2,<span class="hljs-literal">false</span>);
  ui.logd(<span class="hljs-string">&quot;&#x6309;&#x7167;&#x591A;&#x5C11;&#x79D2;&#x6267;&#x884C;:&quot;</span>+jobid2)

  <span class="hljs-keyword">var</span> tags=ui.getAllJobTag();
  ui.logd(<span class="hljs-string">&quot;&#x5B9A;&#x65F6;&#x4EFB;&#x52A1;&#x7684;&#x6807;&#x7B7E;:&quot;</span>+tags)

  <span class="hljs-comment">//&#x53D6;&#x6D88;&#x4EFB;&#x52A1;</span>
   ui.cancelAllJob();
   <span class="hljs-comment">//&#x6309;&#x7167;&#x6807;&#x7B7E;&#x53D6;&#x6D88;&#x4EFB;&#x52A1;</span>
   ui.cancelJob(<span class="hljs-string">&quot;job2&quot;</span>);
}

main();
</code></pre>
</blockquote>
<h2 id="&#x5176;&#x4ED6;&#x6269;&#x5C55;"><a name="&#x5176;&#x4ED6;&#x6269;&#x5C55;" class="anchor-navigation-ex-anchor" href="#&#x5176;&#x4ED6;&#x6269;&#x5C55;"><i class="fa fa-link" aria-hidden="true"></i></a>4.8. &#x5176;&#x4ED6;&#x6269;&#x5C55;</h2>
<h3 id="ui&#x5BF9;&#x5E94;&#x7684;activity-getactivity"><a name="ui&#x5BF9;&#x5E94;&#x7684;activity-getactivity" class="anchor-navigation-ex-anchor" href="#ui&#x5BF9;&#x5E94;&#x7684;activity-getactivity"><i class="fa fa-link" aria-hidden="true"></i></a>4.8.1. UI&#x5BF9;&#x5E94;&#x7684;Activity getActivity</h3>
<ul>
<li>&#x53D6;&#x5F97;&#x5F53;&#x524D;&#x7684;activity&#x5BF9;&#x8C61;</li>
<li>@return Activity &#x5BF9;&#x8C61;&#x6216;&#x8005;null</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">var</span> activity=ui.getActivity();
  ui.logd(<span class="hljs-string">&quot;activity &quot;</span>+activity);
  <span class="hljs-comment">//android context&#x5BF9;&#x8C61;&#x4E5F;&#x662F;&#x81EA;&#x5E26;&#x7684;</span>
  importPackage(android.widget);
  importPackage(android.graphics);
  <span class="hljs-comment">//&#x76F4;&#x63A5;&#x4F7F;&#x7528;java&#x5BF9;&#x8C61;</span>
  <span class="hljs-keyword">var</span> tv = <span class="hljs-keyword">new</span> android.widget.TextView(context);
  tv.setText(<span class="hljs-string">&quot;&#x6211;&#x662F;js&#x548C;java&#x4EA4;&#x4E92;&#x7684;&#x6587;&#x672C;&#x5BF9;&#x8C61;&quot;</span>);
  tv.setTextColor(Color.parseColor(<span class="hljs-string">&quot;#888888&quot;</span>))
  activity.setContentView(tv);
}

main();
</code></pre>
</blockquote>
<h3 id="&#x539F;&#x751F;&#x7684;handler-gethandler"><a name="&#x539F;&#x751F;&#x7684;handler-gethandler" class="anchor-navigation-ex-anchor" href="#&#x539F;&#x751F;&#x7684;handler-gethandler"><i class="fa fa-link" aria-hidden="true"></i></a>4.8.2. &#x539F;&#x751F;&#x7684;Handler getHandler</h3>
<ul>
<li>&#x53D6;&#x5F97;&#x5F53;&#x524D;&#x7684;Handler&#x5BF9;&#x8C61;</li>
<li>@return Handler &#x5BF9;&#x8C61;&#x6216;&#x8005;null</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-comment">//&#x5C55;&#x793A;&#x6D6E;&#x7A97;</span>
    ui.showLogWindow();
    ui.logd(<span class="hljs-string">&quot;&#x663E;&#x793A;&#x6D88;&#x606F;&quot;</span>)
    <span class="hljs-comment">//3&#x79D2;&#x540E;&#x5728;UI&#x7EBF;&#x7A0B;&#x6D88;&#x5931;&#x6389;</span>
    ui.getHandler().postDelayed(<span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>)</span>{
       ui.closeLogWindow();
    },<span class="hljs-number">3000</span>);
}

main();
</code></pre>
</blockquote>
<h3 id="&#x6253;&#x5F00;ec&#x7CFB;&#x7EDF;&#x8BBE;&#x7F6E;-openecsystemsetting"><a name="&#x6253;&#x5F00;ec&#x7CFB;&#x7EDF;&#x8BBE;&#x7F6E;-openecsystemsetting" class="anchor-navigation-ex-anchor" href="#&#x6253;&#x5F00;ec&#x7CFB;&#x7EDF;&#x8BBE;&#x7F6E;-openecsystemsetting"><i class="fa fa-link" aria-hidden="true"></i></a>4.8.3. &#x6253;&#x5F00;EC&#x7CFB;&#x7EDF;&#x8BBE;&#x7F6E; openECSystemSetting</h3>
<ul>
<li>&#x6253;&#x5F00;EC&#x7684;&#x7CFB;&#x7EDF;&#x8BBE;&#x7F6E;</li>
<li>@return &#x5E03;&#x5C14;&#x578B; true&#x4EE3;&#x8868;&#x6210;&#x529F; false&#x4EE3;&#x8868;&#x5931;&#x8D25;</li>
</ul>
<blockquote>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{

    ui.openECSystemSetting();
}

main();
</code></pre>
</blockquote>

<script>console.log("plugin-popup....");document.onclick = function(e){ e.target.tagName === "IMG" && window.open(e.target.src,e.target.src)}</script><style>img{cursor:pointer}</style>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="ui-custom.html" class="navigation navigation-prev " aria-label="Previous page: 原生UI定制">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="ui-js-template.html" class="navigation navigation-next " aria-label="Next page: 模板式UI">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"JS编写UI","level":"1.7.1","depth":2,"next":{"title":"模板式UI","level":"1.7.2","depth":2,"path":"zh-cn/funcs/ui-js-template.md","ref":"zh-cn/funcs/ui-js-template.md","articles":[]},"previous":{"title":"原生UI定制","level":"1.7","depth":1,"path":"zh-cn/funcs/ui-custom.md","ref":"zh-cn/funcs/ui-custom.md","articles":[{"title":"JS编写UI","level":"1.7.1","depth":2,"path":"zh-cn/funcs/ui-js-inter.md","ref":"zh-cn/funcs/ui-js-inter.md","articles":[]},{"title":"模板式UI","level":"1.7.2","depth":2,"path":"zh-cn/funcs/ui-js-template.md","ref":"zh-cn/funcs/ui-js-template.md","articles":[]},{"title":"原生UI控件","level":"1.7.3","depth":2,"path":"zh-cn/funcs/ui-native-view.md","ref":"zh-cn/funcs/ui-native-view.md","articles":[{"title":"LinearLayout线性布局","level":"1.7.3.1","depth":3,"path":"zh-cn/funcs/ui/linearlayout.md","ref":"zh-cn/funcs/ui/linearlayout.md","articles":[]},{"title":"FrameLayout帧布局","level":"1.7.3.2","depth":3,"path":"zh-cn/funcs/ui/framelayout.md","ref":"zh-cn/funcs/ui/framelayout.md","articles":[]},{"title":"RelativeLayout绝对布局","level":"1.7.3.3","depth":3,"path":"zh-cn/funcs/ui/relativelayout.md","ref":"zh-cn/funcs/ui/relativelayout.md","articles":[]},{"title":"ScrollView滚动框","level":"1.7.3.4","depth":3,"path":"zh-cn/funcs/ui/scrollview.md","ref":"zh-cn/funcs/ui/scrollview.md","articles":[]},{"title":"View视图","level":"1.7.3.5","depth":3,"path":"zh-cn/funcs/ui/view.md","ref":"zh-cn/funcs/ui/view.md","articles":[]},{"title":"Button按钮","level":"1.7.3.6","depth":3,"path":"zh-cn/funcs/ui/button.md","ref":"zh-cn/funcs/ui/button.md","articles":[]},{"title":"TextView文本","level":"1.7.3.7","depth":3,"path":"zh-cn/funcs/ui/textview.md","ref":"zh-cn/funcs/ui/textview.md","articles":[]},{"title":"EditText输入框","level":"1.7.3.8","depth":3,"path":"zh-cn/funcs/ui/edittext.md","ref":"zh-cn/funcs/ui/edittext.md","articles":[]},{"title":"CheckBox复选框","level":"1.7.3.9","depth":3,"path":"zh-cn/funcs/ui/checkbox.md","ref":"zh-cn/funcs/ui/checkbox.md","articles":[]},{"title":"RadioGroup布局","level":"1.7.3.10","depth":3,"path":"zh-cn/funcs/ui/radiogroup.md","ref":"zh-cn/funcs/ui/radiogroup.md","articles":[]},{"title":"RadioButton单选框","level":"1.7.3.11","depth":3,"path":"zh-cn/funcs/ui/radiobutton.md","ref":"zh-cn/funcs/ui/radiobutton.md","articles":[]},{"title":"Spinner下拉选择框","level":"1.7.3.12","depth":3,"path":"zh-cn/funcs/ui/spinner.md","ref":"zh-cn/funcs/ui/spinner.md","articles":[]},{"title":"WebView内嵌浏览器","level":"1.7.3.13","depth":3,"path":"zh-cn/funcs/ui/webview.md","ref":"zh-cn/funcs/ui/webview.md","articles":[]},{"title":"ImageView图像","level":"1.7.3.14","depth":3,"path":"zh-cn/funcs/ui/imageview.md","ref":"zh-cn/funcs/ui/imageview.md","articles":[]},{"title":"CardView卡片布局","level":"1.7.3.15","depth":3,"path":"zh-cn/funcs/ui/cardview.md","ref":"zh-cn/funcs/ui/cardview.md","articles":[]},{"title":"Swtich开关按钮","level":"1.7.3.16","depth":3,"path":"zh-cn/funcs/ui/switch.md","ref":"zh-cn/funcs/ui/switch.md","articles":[]}]}]},"dir":"ltr"},"config":{"plugins":["chapter-fold","code","copy-code-button","-lunr","-search","search-pro","anchor-navigation-ex","hide-element","favicon-absolute","popup"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"chapter-fold":{},"search-pro":{},"popup":{},"code":{"copyButtons":true},"favicon-absolute":{"appleTouchIconMore":{},"appleTouchIconPrecomposed152":"/zh-cn/images/ico.png","appleTouchIconPrecomposedMore":{},"favicon":"/zh-cn/images/ico.png"},"hide-element":{"elements":[".gitbook-link"]},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":true,"showLevel":true},"copy-code-button":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"EasyClick开发文档","language":"zh-hans","gitbook":"*","description":"记录EasyClick开发教程和常用的函数"},"file":{"path":"zh-cn/funcs/ui-js-inter.md","mtime":"2020-05-25T02:55:04.834Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-05-27T06:59:59.950Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-copy-code-button/toggle.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-hide-element/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

